Hello all,
The following script works just fine with my server on my local network, but when I upload it to our internet host it renders the text ONLY FOR SOME FONTS as little black boxes. I'm stumped, the tech support guys at our host are stumped -- only you can help! 🙂
The font files that I'm passing to this script are all in the same directory. I don't think the problem is with my script, I have a feeling that it has to do with the configuration of the server...but I'm willing to be proven wrong!
Thanks for your time!
Jeff
set_magic_quotes_runtime(0);
$font = $_SERVER["DOCUMENT_ROOT"]."/".$font;
header("Content-type: image/png");
if(!isset($s)) $s=11;
$size = imagettfbbox($s, 0, $font, $string);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=9;
$ypad=9;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$black = ImageColorAllocate($im, 0, 0, 0);
if(isset($hilite))
$bg = ImageColorAllocate($im, 84,172,72);
else
$bg = ImageColorAllocate($im, 192,168,136);
ImageFill($im, 0, 0, $bg);
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, $font, $string);
ImagePng($im);
ImageDestroy($im);
set_magic_quotes_runtime(get_magic_quotes_gpc());