|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11994 imagettfbbox returns null
Submitted: 2001-07-09 20:19 UTC Modified: 2001-08-20 11:20 UTC
From: whanley at mindspring dot com Assigned:
Status: Closed Package: GD related
PHP Version: 4.0.6 OS: WIN98
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: whanley at mindspring dot com
New email:
PHP Version: OS:


 [2001-07-09 20:19 UTC] whanley at mindspring dot com
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);
   $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);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-21 20:54 UTC]
Check your $font variable it will translate into
"\windows\fonts\CACVALIA.ttf" which last time I checked is
not a valid location for a font, either on windows or linux.
 Also try setting error_reporting to a high number to see
ALL of the notices, errors, warnings, etc...

 [2001-08-20 11:20 UTC]
no feedback.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 01 10:05:53 2022 UTC