Well, maybe this is a newbie question, but GD doesn't seem to be a newbie topic... anyways...
I'm having trouble with the TTF support for GD. Images are created/displayed fine, but when i try to use any function that requires me to link to a TTF font, it craps out.
Here is my code (copied almost directly from one of the articles on GD at this site):
<?
Header("Content-type: image/png");
if(!isset($s)) $s=11;
$text = "Wally";
$font = "Arlrdbd.ttf";
$size = imagettfbbox($s,0,$font,$text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=9;
$ypad=9;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white);
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, $font, $text);
ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, $font, $text);
ImagePNG($im);
ImageDestroy($im);
?>
it gives me errors (@vx; whats this??) on lines 6, 17, and 18, exactly where I'm using $text, the variable that links to my TTF file (I'm sure that the filename is correct, btw). If I comment out thes lines, no problems occur.
So, can anyone help me pinpoint the problem? I'm using GD "2.0 or higher" as reported by PHPinfo(), freetype support is enabled, and I have freetype linkage "with freetype", whatever that means.
Also, another question on an (almost) unrelated topic, Where can I get GD with GIF support. The only one that I found was at http://php.weblogs.com/php_gd, but for some reason it doesnt work (the pages take forever to load); I think that its because it was compiled for PHP v. 4.0.3, and I have 4.0.1 ... hmm.
Well, any help would be appreciated. Thanks!
Wally-o