[thelist] Using TTF within an image

CDitty mail at redhotsweeps.com
Sat Jul 5 11:44:36 CDT 2003

Thanks.  I guess I didn't look far enough down the list.  I'll give this a 
try later today.


At 01:28 AM 7/5/2003, Jim Puls wrote:
>You don't want imageloadfont(); that's an ugly, gd-laden monstrosity that 
>is more for historical stuff.
>You want to look at imagettftext(): the manual entry at 
>http://us3.php.net/manual/en/function.imagettftext.php explains it in 
>pretty exhaustive detail.
>Note that it does require two libraries.
>On Friday, July 4, 2003, at 9:37 AM, CDitty wrote:
>>Can someone please show me how to change the display font to a TTF in 
>>this code? I looked at the online manual under imageloadfont(), but I did 
>>not understand it enough. I have the MS TTFs installed on my server and 
>>they are working correctly.
>>header ("Content-type: image/png");
>>$string = "Text message goes here";
>>$font = "2";
>>$width = ImageFontWidth($font) * strlen($string);
>>$height = ImageFontHeight($font);
>>$im = @imagecreate ($width,$height);
>>$background_color = imagecolorallocate ($im, 255, 255, 255); //white 
>>$text_color = imagecolorallocate ($im, 0, 0,0);//black text
>>imagestring ($im, $font, 0, 0, $string, $text_color);
>>imagepng ($im);
>Jim Puls <jim at nondifferentiable.com>
>* * Please support the community that supports you.  * *
>Evolt.org conference in London, July 25-27 2003.  Register today at 
>For unsubscribe and other options, including the Tip Harvester and 
>archives of thelist go to: http://lists.evolt.org Workers of the Web, evolt !

More information about the thelist mailing list