note 26160 deleted from function.imagettftext by aidan

From: Date: Mon, 20 Sep 2004 10:07:10 +0000
Subject: note 26160 deleted from function.imagettftext by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77036@lists.php.net to get a copy of this message
Note Submitter: php dot net at hatterscheid dot info ---- If you want more space between the chars. You can use this example: <? header("Content-type: image/png"); $imagewidth = 250; $imageheight = 50; $fontsize = 36; $space = 6; $xpos = 20; $ypos = 40; $text = "Example"; $im = imagecreate ($imagewidth, $imageheight); $bgcolor = ImageColorAllocate ($im, 202, 112, 112); $font = ImageColorAllocate ($im, 255, 255, 255); function make_text($char, $xpos, $fontsize, $space, $imagewidth, $imageheight) { global $im, $ypos, $font; $thetextbox = ImageTTFBBox ($fontsize, 0, "arial.ttf", $char); ImageTTFText ($im, $fontsize, 0, $xpos, $ypos, $font, "arial.ttf", $char); return $xpos+$thetextbox[4]+$space; } for($i=0;substr($text, $i,1);$i++) { $xpos = make_text(substr($text, $i,1), $xpos, $fontsize, $space, $imagewidth, $imageheight); } Imagepng ($im); ImageDestroy ($im); ?>

« previous php.notes (#77036) next »