<?php
// This is a demonstration script to allow you to experiment with
// different settings to get a feel for what this class can do.
// It was written fairly quickly so it may not be the best quality program.
$txt=($_GET['txt'])?$_GET['txt']:"Enter text here";
$tx=explode("\n",$txt);
$gt="txt=".$tx[0];
for($i=1;$i<count($tx);$i++){
$gt.="%0D%0A".$tx[$i];
}
$gt.="&tr=".$tr=(isset($_GET['tr']))?$_GET['tr']:0;
$gt.="&tg=".$tg=(isset($_GET['tg']))?$_GET['tg']:0;
$gt.="&tb=".$tb=(isset($_GET['tb']))?$_GET['tb']:0;
$gt.="&fnt=".$fnt=(isset($_GET['fnt']))?$_GET['fnt']:'arial.ttf';
$gt.="&sz=".$sz=(isset($_GET['sz']))?$_GET['sz']:12;
$gt.="&h=".$h=(isset($_GET['h']))?$_GET['h']:'center';
$gt.="&v=".$v=(isset($_GET['v']))?$_GET['v']:'center';
$gt.="&j=".$ju=(isset($_GET['j']))?$_GET['j']:'center';
$gt.="&b=".$b=(isset($_GET['b']))?$_GET['b']:'0';
$gt.="&wd=".$wd=(isset($_GET['wd']))?$_GET['wd']:NULL;
$gt.="&ht=".$ht=(isset($_GET['ht']))?$_GET['ht']:NULL;
$gt.="&fm=".$fm=(isset($_GET['fm']))?$_GET['fm']:'gif';
$gt.="&img=".$img=(isset($_GET['img']))?$_GET['img']:'';
$gt.="&si=".$si=(isset($_GET['si']))?$_GET['si']:'no';
$gt.="&di=".$di=(isset($_GET['di']))?$_GET['di']:'1';
$gt.="&submit=".$_GET['submit'];
?>
<html><head></head><body>
<H2>A Demonstration of the ATextImage Class</H2><br>
<?php
if($_REQUEST['di']=='1'){
print "<img src='formimage.php?$gt'>";
}
print "<form action='$PHP_SELF' method='GET'>";
print "Enter the text to put in picture:<br>";
print "(You can hit Enter key and make multiple lines in the image.)<br>";
print "<textarea name='txt' cols=35 rows=4>$txt</textarea><br>";
print "Enter the text color (red,green,blue) 0 to 255 :";
print "<input type='text' name='tr' size='5' value='$tr'>";
print "<input type='text' name='tg' size='5' value='$tg'>";
print "<input type='text' name='tb' size='5' value='$tb'><br>";
print "Enter font file path and font size: ";
$fonts = glob("{*.ttf,*.TTF}", GLOB_BRACE);
print "<select name='fnt'>";
foreach($fonts as $font){
$sel=($fnt==$font)?' selected':'';
print "<option value='$font'$sel>$font</option>\n";
}
print "</select><br>\n";
//print "<input type='text' name='fnt' value='$fnt' size='20'>";
print "<input type='text' name='sz' value='$sz' size='5'><br>";
print "Select horizontal position: \n";
print "<select name='h'>\n";
$sel=($h=='left')?' selected':'';
print " <option value='left' $sel>Left</option>\n";
$sel=($h=='center')?' selected':'';
print " <option value='center' $sel>Center</option>\n";
$sel=($h=='right')?' selected':'';
print " <option value='right' $sel>Right</option>\n";
print "</select>\n";
print "Select vertical position:";
print "<select name='v'>";
$sel=($v=='top')?' selected':'';
print " <option value='top'$sel>Top</option>";
$sel=($v=='center')?' selected':'';
print " <option value='center'$sel>Center</option>";
$sel=($v=='bottom')?' selected':'';
print " <option value='bottom'$sel>Bottom</option>";
print "</select>";
print "Select justification of text:";
print "<select name='j'>";
$sel=($ju=='left')?' selected':'';
print " <option value='left'$sel>Left</option>";
$sel=($ju=='center')?' selected':'';
print " <option value='center'$sel>Center</option>";
$sel=($ju=='right')?' selected':'';
print " <option value='right'$sel>Right</option>";
print "</select>";
print "<br>";
print "Put a border around the image?:";
print "<select name='b'>";
$sel=($b=='0')?' selected':'';
print " <option value='0'$sel>No</option>";
$sel=($b=='1')?' selected':'';
print " <option value='1'$sel>Yes</option>";
print "</select><br>";
print "Enter width and height of blank image:";
print "<input type='text' name='wd' size='5' value='$wd'>";
print "<input type='text' name='ht' size='5' value='$ht'>";
print " OR Select an image file:";
// Find the images in this directory to choose from.
$images = glob("{*.gif,*.jpg,*.png}", GLOB_BRACE);
print "<select name='img'>";
$sel=($img=='')?'':' selected';
print "<option value=''$sel>none</option>\n";
foreach($images as $image){
$sel=($img==$image)?' selected':'';
print "<option value='$image'$sel>$image</option>\n";
}
print "</select><br>\n";
print "Choose new image format:";
print "<select name='fm'>";
$sel=($fm=='jpg')?' selected':'';
print " <option value='jpg'$sel>jpg</option>";
$sel=($fm=='gif')?' selected':'';
print " <option value='gif' $sel>gif</option>";
$sel=($fm=='png')?' selected':'';
print " <option value='png'$sel>png</option>";
print "</select>";
print "Save image to filename atest.xxx:";
print "<select name='si'>";
$sel=($si=='no')?' selected':'';
print " <option value='no'$sel>No</option>";
$sel=($si=='yes')?' selected':'';
print " <option value='yes'$sel>Yes</option>";
print "</select><br>";
print "Display image to screen:";
print "<select name='di'>";
$sel=($di=='1')?' selected':'';
print " <option value='1'$sel>Yes</option>";
$sel=($di=='0')?' selected':'';
print " <option value='0'$sel>No</option>";
print "</select><br>";
print "<input type='submit' name='submit' value='submit'><br>";
print "</form>";
?>
</body></html>
|