Bug #11994: imagettfbbox returns null
| From: | whanley at mindspring dot com | Date: | Tue, 10 Jul 2001 00:19:28 +0000 |
| Subject: | Bug #11994: imagettfbbox returns null | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-59475@lists.php.net to get a copy of this message | ||
From: whanley@mindspring.com
Operating system: WIN98
PHP version: 4.0.6
PHP Bug Type: GD related
Bug description: imagettfbbox returns null
imagettfbbox fails to return coordinates under distribution for win32 for
PHP Version 4.0.6 using distribution binaries. Unzipping PHP Version
4.0.4pl1 over 4.0.6 files and the example works again same config used for
both.
here is sample script used to test
<?
Header("Content-Type: image/png");
$im = ImageCreateFrompng('C:\windows\backgrnd.png');
$str = "Hello World";
$font = "\\windows\\fonts\\CACVALIA.ttf";
// print $font;
$bbox = imagettfbbox(40,0,$font, $str);
// print $bbox;
$black = ImageColorAllocate($im,128,128,128);
// print "$bbox[0],$bbox[1],$bbox[2],$bbox[3],$bbox[4]";
$start_x = ImageSX($im)/2 - (($bbox[0] + $bbox[2] + $bbox[4] + $bbox[6])
/ 4);
$start_y = ImageSY($im)/2 - (($bbox[1] + $bbox[3] + $bbox[5] + $bbox[7])
/ 4);
$white = ImageColorAllocate($im,255,255,255);
$red = ImageColorAllocate($im,255,0,0);
ImageLine($im,0,0,200,200,$red);
$gray = ImageColorAllocate($im,196,196,196);
ImageTTFText($im, 40, 0, $start_x+3, $start_y-3, $black, $font, $str);
ImageTTFText($im, 40, 0, $start_x,$start_y, $gray, $font, $str);
// ImageColorTransparent($im, $black);
Imagepng($im);
ImageDestroy($im);
?>
--
Edit bug report at: http://bugs.php.net/?id=11994&edit=1