10) $antialias= 1; else $antialias= 0; // setup pt. 2 $fontfile= $fontpath.$font; // geometry $box= imageftbbox( $size, 0, $fontfile, $textval, array()); $boxwidth= $box[4]; $boxheight= abs($box[3]) + abs($box[5]); $width= $boxwidth + ($padding*2) + 1; $height= $boxheight + ($padding*2) + 0; $textx= $padding; $texty= ($boxheight - abs($box[3])) + $padding; //print "$width x $height ($box[4] x ($box[3] - $box[5]))"; exit; // create the image $png= imagecreate($width, $height); // colors function mkcolor($color){ // courtesy simon: http://www.php.net/manual/en/function.imagecolorallocate.php#19576 global $png; $color = str_replace("#","",$color); $red = hexdec(substr($color,0,2)); $green = hexdec(substr($color,2,2)); $blue = hexdec(substr($color,4,2)); $out = imagecolorallocate($png, $red, $green, $blue); return($out); } $bg= mkcolor($bgcolor); $tx= mkcolor($textcolor); // transparency if ($transparent==1) { $tbg= imagecolortransparent($png, $bg); } // antialiasing if (!$antialias) { $tx= (0 - $tx); } // add text imagefttext( $png, $size, 0, $textx, $texty, $tx, $fontfile, $textval, array()); // send the image if ($showsource=="") { header("content-type: image/png"); imagepng($png); } else { print " Labelgen.php

PHP Source:

"; $source= show_source($_SERVER['SCRIPT_FILENAME']); print "
labelgen.php Copyright (C) 2003 by Chris Snyder
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; please refer to the GNU General Public License for details. "; } imagedestroy($png); ?>