[nycphp-talk] GD imagettftext font problem
tedd
tedd at sperling.com
Tue Mar 21 18:48:23 EST 2006
>I am trying to build a graph and get the following error on my new Linux
>server:
>
>ERRNO: 2
>TEXT: imagettftext() [function.imagettftext]: Could not find/open font
>
>This is the output of phpinfo:
>GD Support enabled
>GD Version bundled (2.0.28 compatible)
>FreeType Support enabled
>FreeType Linkage with freetype
>FreeType Version 2.1.9
>T1Lib Support enabled
>GIF Read Support enabled
>GIF Create Support enabled
>JPG Support enabled
>PNG Support enabled
>WBMP Support enabled
>XBM Support enabled
>
>I assume my instal can't find the fonts. What path setting should I be
>changing. What does the font file look like so I can see if it's
>installed on the system?
>
>Cliff
Cliff:
Try the following to test stuff:
<?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
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
More information about the talk
mailing list