Page 1 of 1

imagefttext working locally, but error on prodserver

Posted: Thu Jul 23, 2009 4:33 am
by kae
Hi.
I'm pretty new to PHP and are trying to make a script that generates a png from a textstring using imagefttext and a custom font in the same folder as the script. Everything works locally, but when I try it on the prodserver (Mac) I get Thread 0 Crashed in my logs.
I see in php info that gd-imgstrttf & gd-native-ttf are enabled on my local server, but not on the prodserver. I've tried to google som info about those, but find very little (except for how to recompile php to enable them).

Any help appreciated :-)

My code:

Code: Select all

<?php
    header('Content-type: image/png');
    //  putenv('GDfontPATH=' . realpath('.'));
    $font_file = 'categoryfont_bd.ttf';
    is_readable($font_file) or die('font file cannot be accessed !');
    $im = imagecreatetruecolor(500, 100);
    $backColor = imagecolorallocate($im, 0xFF, 0xaf, 0xff);
    $textColor = imagecolorallocate($im, 0x34, 0x77, 0x30);
 
    imagefilledrectangle($im, 0, 0, 500, 99, $backColor);
 
    imagefttext($im, 40 0, 10, 50, $textColor, $font_file, "Test");
 
    imagepng($im, 'text.jpg', 100);
    imagedestroy($im);
?>