NYCPHP Meetup

NYPHP.org

[nycphp-talk] GD imagettftext font problem

Cliff Hirsch cliff at pinestream.com
Tue Mar 21 21:10:14 EST 2006


Thanks to all for the help. Here's a summary of what I did:

1. I installed FreeType: http://freetype.sourceforge.net/index2.html
      FreeType Jam did not work, but the standard Make did work.
2. I discovered that FreeType <> fonts. I thought that was the point!
3. I downloaded Arial.ttf as suggested by Tedd from the URL below.
4. I put the font in my html docroot for now -- simple, as suggested by
Jeff.
5. I renamed Arial.ttf to arial.ttf to deal with the joy of case
sensitivity.

This test script from Tedd worked beautifully.

<?php
Header ("Content-type: image/gif");
$im = imagecreate (150, 150);
$background = ImageColorAllocate ($im, 238, 238, 238);
$text_color = ImageColorAllocate ($im, 00, 51, 102);	//#036 00 33 66
HEX
ImageTTFText ($im, 20, 45, 30, 130, $text_color, "arial.ttf", "Hello
World...");
ImageGif ($im);
ImageDestroy ($im);
?>

You can get arial.tiff (along with other fonts) at:

http://www.webpagepublicity.com/free-fonts.html




More information about the talk mailing list