php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22092 Strange warning and no functionality in imagettfbbox and imagettftext
Submitted: 2003-02-06 12:46 UTC Modified: 2003-06-15 23:46 UTC
Votes:26
Avg. Score:4.1 ± 1.0
Reproduced:23 of 23 (100.0%)
Same Version:9 (39.1%)
Same OS:7 (30.4%)
From: davidl at tocquigny dot com Assigned:
Status: No Feedback Package: GD related
PHP Version: 4.3.2 OS: Redhat 7.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: davidl at tocquigny dot com
New email:
PHP Version: OS:

 

 [2003-02-06 12:46 UTC] davidl at tocquigny dot com
here is the script:
<?php
print file_exists("fonts/arial.ttf");
imagettfbbox(20, 0, "fonts/arial.ttf","Testing... ");
?>

which produces the following:
1
Warning: imagettfbbox() [function.imagettfbbox]: ????G?@?%@ in /xxx/xxx/xxx/xxx/test2.php on line 3

so the font file exists, I don't know if that is the problem or not, but if I turn off error reporting, and use imagettftext, the text doesn't show up.  I have several applications placing text on a jpeg that work in 4.2.3 and don't place any text in 4.3.0, making 4.3.0 unusable to me until I can figure out what the difference is.  fyi, compile flags are:

for 4.2.3 (working fine):
'./configure' '--with-apxs' '--with-mysql' '--with-ttf' '--with-jpeg-dir' '--with-gd' '--with-xpm-dir=/usr/X11R6' '--with-png' '--with-zlib' '--enable-track-vars' '--without-oracle' '--without-oci8' '--with-xml' '--with-pdflib=/usr/local' 

for 4.3.0 (not working):
'./configure' '--with-apxs' '--with-mysql' '--with-xpm-dir=/usr/X11R6' '--with-ttf' '--with-zlib' '--enable-track-vars' '--without-oracle' '--without-oci8' --with-gd '--with-xml' '--with-pdflib=/usr/local' '--disable-cgi' --with-jpeg-dir=/usr/lib/ --with-png --enable-gd-native-ttf

Trying the same compile flags for 4.3 as was used on 4.2.3 doesn't work as well.

Thanks in advance.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-06 12:48 UTC] davidl at tocquigny dot com
just fyi, I put the /xxx/xxx/xxx in the file path to hide my directory structure, however the gibberish for a warning came completely from php :)
 [2003-02-06 13:18 UTC] davidl at tocquigny dot com
also tried adding --with-ttf to the 4.3.0 compile, still no love
 [2003-02-06 13:33 UTC] iliaa@php.net
Try adding the --with-freetype-dir option to your configure. As is I cannot replicate the bug using the latest CVS (4.3.1-dev).
 [2003-02-06 15:01 UTC] davidl at tocquigny dot com
okies, that fixed one problem and created another (although MUCH LESS MAJOR)

the results now:
1
Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open font in /xxx/xxx/xxx/xxx/test2.php on line 3

if I put an absolute path into the font location, it works, but relative paths do not.
 [2003-02-06 15:15 UTC] davidl at tocquigny dot com
Also, it won't accept spaces in the font file name, if I have no spaces (ie arial.ttf) it works, with spaces (ie "futura bold.ttf") generates:
Could not find/open font in /xxx/xxx/xxx/test2.php on line 3
 [2003-02-08 13:13 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Also, try specifying the full path to the font, by doing realpath() on the font path before passing it to imagettfbox().
 [2003-02-20 08:08 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-03-13 14:00 UTC] FR at ncis dot ca
We also have this bug with 4.3.1
 [2003-04-10 08:51 UTC] kadlcakd at yahoo dot com
I have the same problem with 4.3.1

I have GD 2.0.4 compiled with TTF support, php 4.3.1 compiled --with-gd --with-ttf --with-freetype-dir


ImageTTFBBox( 18, 0, "fonts/times.ttf", "Hello" );

Gives an error:
Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open font in /usr2/accnts/theuser/www/tests/button.php

Dave.
 [2003-05-27 17:30 UTC] paul at thewall dot de
I can confirm this bug, it still persist. A Full path did not help, as well as renaming the font file and cutting off the extension (which is reported to work).

I have tried GD extension versions 1 and 2, same result. PHP Version is 4.2.3.
 [2003-05-29 10:47 UTC] davidl at tocquigny dot com
The problem with spaces in the font name continues in 4.3.2.  A font "arial.ttf" works but "futura bold.ttf" generates the error:

Warning: imagettfbbox(): Could not find/open font in /xxx/xxx/xxx/custom_class.php on line 535
 [2003-06-15 23:46 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2007-07-17 12:17 UTC] xeon at adamant dot net
I also have this bug with PHP-4.4.7 and 5.2.3 :(
 [2009-08-04 03:28 UTC] bugs-php at markrobertwilkins dot com
similar problem with PHP v5.2.8 on linux 2.6.13.4

php spins when it can't find the font file, using all available cores and ultimately filling the error log filesystem.

file is not found on font path (i.e. --with-freetype-dir ) nor in current working dir except when specifying ./path or absolute path.
 [2009-10-16 16:33 UTC] ditemoi at hotmail dot fr
try this : 
 imagettfbbox(20, 0, "../fonts/arial.ttf","Testing... ");
I don't know why ? but it's works for me.

Hope your help..
sorry for my broken english !!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 12:01:29 2024 UTC