php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34925 imagettftext broken on 64 bit
Submitted: 2005-10-20 10:15 UTC Modified: 2005-10-20 17:10 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: keith dot miller at ricardo dot com Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.0.5 OS: RHEL 2.6.9-11.EL SMP
Private report: No CVE-ID: None
 [2005-10-20 10:15 UTC] keith dot miller at ricardo dot com
Description:
------------
imagettftext() ignores absolute positions in this version of PHP.
The same code works properly in previous versions. TrueType fonts are now always aligned on the LHS of the image, and positioning is completely broken.

This is built on 64-bit Red Hat Enterprise with gcc (GCC) 3.4.3 20050227 (Red Hat 3.4.3-22.1).

gcc -m64 (other flags are default produced by configure)

Everything else on the system in stock redhat (with latest patches applied under support contract)

Reproduce code:
---------------
<?php
// Set the content-type
header("Content-type: image/png");

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 255, 255, 255);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = '/var/www/ttf/arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 111, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 101, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>


Expected result:
----------------
Text should be aligned offset from the LHS of the image, not at the LHS.
In previous versions of PHP, this works correctly.


Actual result:
--------------
Text is aligned at the LHS of the image, regardless of the X & Y values.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-20 10:19 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip
 [2005-10-20 10:20 UTC] keith dot miller at ricardo dot com
should be under image, not GD
 [2005-10-20 10:24 UTC] derick@php.net
It's GD functionality, so the category was fine. Please test with the snapshot...
 [2005-10-20 17:05 UTC] keith dot miller at ricardo dot com
Yes, the latest snapshot fixes the gd problem for me, although it now seems to have introduced a rather unpleasant new bug that causes the PHP to hang with 100% CPU usage when trying to connect to SQL server (mssql) (with latest libtds). I don't think this snapshot can be deployed as is. Probably best to go back to 5.0.4 (which didn't seem to have the truetype issue)
 [2005-10-20 17:10 UTC] pajoye@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Please another bug about your mssql problem.

TTF problem solved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 13:01:29 2024 UTC