php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25926 ImageTTFText and ImageTTFBox don't work and return weird values
Submitted: 2003-10-20 15:50 UTC Modified: 2003-10-30 21:08 UTC
Votes:7
Avg. Score:4.9 ± 0.3
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:2 (33.3%)
From: olga at bluebytes dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.3 OS: Linux
Private report: No CVE-ID: None
 [2003-10-20 15:50 UTC] olga at bluebytes dot com
Description:
------------
ImageTTFText doesn't output any characters. If there's anything else in the image, the rest will be fine; if the text string is the only thing, the image will be blank.
Trying to figure out what's wrong, I took a look at the return values from ImageTTFText as well as ImageTTFBox. They both produce huge values, i.e. Array ( [0] => 138323388 [1] => 11 [2] => -1073754136 [3] => 1076636124 [4] => 138611764 [5] => 138323484 [6] => 11 [7] => 0 ) 

The values DO NOT depend on the font used. Furthermore, they are different each time I load the page for the SAME font (http://blunoise.com/imagetext.php shows values for "Hello world" in arial).

Reproduce code:
---------------
<?php
  //header("Content-type: image/jpeg");
  error_reporting('E_ALL');
  $im = imagecreate(400,30);
  $white = imagecolorallocate($im, 255,255,255);
  $black = imagecolorallocate($im, 0,0,0);

  // Replace path by your own font path
  $result = imagettftext($im, 12, 0, 6, 20, $black, "/home/blunoise/fonts/arial.ttf", "Hello world");
  $bbox=imagettfbbox (12, 0, "/home/blunoise/fonts/arial.ttf", "Hello world");
  print_r($bbox);

  //imagepng($im);
  imagedestroy($im);
?>


Expected result:
----------------
A jpeg saying "Hello world"


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-21 15:38 UTC] sniper@php.net
Using latest STABLE CVS snapshot with bundled GD library works just fine.

 [2003-10-21 17:33 UTC] olga at bluebytes dot com
Actually, I just installed PHP Version 4.3.4RC3-dev which is marked as stable on snaps.php.net, and it's still not working.
 [2003-10-22 01:47 UTC] sniper@php.net
What was the configure line you used to configure PHP?
If you didn't use the _bundled_ GD library, close this.

 [2003-10-22 09:56 UTC] olga at bluebytes dot com
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-xml' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-ming=../ming-0.2a' '--enable-magic-quotes' '--with-mysql' '--with-pear' '--enable-sockets' '--enable-track-vars' '--enable-versioning' '--with-zlib' '--with-ttf' '--with-freetype' '--enable-gd-native-ttf' '--enable-exif' 

I am assuming --wtih-gd uses bundled version. Sorry if I am incorrect.
 [2003-10-30 20:42 UTC] sniper@php.net
Works fine for me. Update your freetype2 lib, get proper fonts, working script, etc. and it will work for you too.

 [2003-10-30 21:00 UTC] olga at bluebytes dot com
My freetype lib is the latest, I tried fonts both from Windows distribution and the ones from freetype site; the script was a sample taken from php.net documentation. I am not the only one with this problem!
 [2003-10-30 21:08 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

It works for me. As long as you can't provide information with which this could be reproduced -> bogus.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Aug 20 06:01:30 2024 UTC