GD - Problem writing text
| From: | Fredrik Thunberg | Date: | Thu, 23 Nov 2006 15:30:27 +0000 |
| Subject: | GD - Problem writing text | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-245096@lists.php.net to get a copy of this message | ||
Hi all
This is my first attempt to wrie to this mailing list, so please bare with me.
My problem is as follows
I'm trying to generate a dynamic picture with some text on it. The code works fine on one of my servers, but not on the other one.
The code I'm using:
$im = imagecreatetruecolor (400, 100);
$black = imagecolorallocate ($im, 0, 0, 0 );
$white = imagecolorallocate ($im, 255, 255, 255 );
imagerectangle ($im,0, 0,399,99 ,$black);
imagefilledrectangle ($im,0, 0,399,99 ,$white);
imagettftext ($im, 30, 0, 10, 40 , $black, TTF_DIR. "times.ttf", "Hello World!");
header ("Content-type: image/png" );
imagepng ($im);
Where TTF_DIR is the complete path to the times.ttf-file (which i've chmodded to 777).
This is the gd-info from where it works:
GD Support enabled GD Version bundled (2.0.28 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.1.3 GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabledThe one things that differs between the servers is:
"FreeType Linkage with TTF library" is set on the faulty one. Can this be the problem?Cheers /Fredrik Thunberg thunis@webguidepartner.com