PHP crashes when using gd with true type fonts.
| From: | Branko F. Gračnar | Date: | Fri, 13 Jun 2003 12:50:07 +0000 |
| Subject: | PHP crashes when using gd with true type fonts. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-151353@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi
Check out the following code:
<?php
$image_file = "images/test.gif";
$font_file = dirname(__FILE__) . "/" . "fonts/timesbd.ttf";
$str = "You must be kidding :)";
$red = 0;
$blue = 0;
$green = 0;
$img = imagecreatefromgif("images/test.gif");
$color = imagecolorallocate($img, $red, $blue, $green);
# use TTF
imagettftext($img, 20, -20, 20, 40, $color, $font_file, $str);
/*
int imagestring ( resource image, int font, int x, int y, string s, int col)
*/
# don't use ttf
# imagestring($img, 5, 0, 0, $str, $color);
header("Content-Type: image/gif");
imagegif($img);
imagedestroy($img);
?>
When i use imagettftext() i httpd child process always crashes with signal 11
and in 20% requests it doesn't serve the image.
If i use imagestring() everything works okay, with no crashes at all..
Any ideas?
system: freebsd 5.1 release
httpd: apache 2.0.46
php: 4.3.2
freetype: 2.1.4
gd: 2.0.11
Ideas? I REALLY need TTF support in php.
Brane
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)
iD8DBQE+6ch/Upzh9iszIGARArHIAJ0fcp43LHVuV7v/DhNJT2RG7JSXmwCfd4g+
2N8dUxLepFMCZR5/QyDWcMw=
=Rjox
-----END PGP SIGNATURE-----