From: mhinck at suscom dot net
Operating system: Fedora Core 2
PHP version: 5.0.5
PHP Bug Type: GD related
Bug description: imageFTText x coordinate not working
Description:
------------
After upgrading from 5.0.2 to 5.0.5 the x coordinate in the imageFTText is
doing nothing. All other arguments work as expected but the x coordinate
is ignored. Example uses arial but tried with many fonts with same
result. GD is version 2.0.28. Following config ran without issue:
./configure --with-apxs2=/usr/local/apache2/bin/apxs
--with-mysqli=/usr/local/mysql/bin/mysql_config
--with-mysql=/usr/local/mysql/ --with-t1lib=/usr/local/lib
--enable-fast-cgi --enable-magic-quotes --with-openssl --enable-sockets
--enable-debug --with-zlib --with-cyrus --enable-exif --with-gd=/usr
--with-freetype-dir=/usr/local --enable-calendar --with-gettext --with-xml
--enable-dom --with-iconv --enable-mbstring --with-mbstring=all
--with-kerberos --with-mcrypt --with-cyrus --with-imap --with-imap-ssl
--with-mcal=/usr/lib --with-ldap --with-ldap-sasl
Reproduce code:
---------------
<?php
$im = LoadPNG("blank.png"); //A straight white png file.
imagecolortransparent ($im, imagecolorat ($im, 0, 0));
$font = "/usr/X11R6/lib/X11/fonts/TTF/arial.ttf";
$txtcr = imagecolorallocate($im, 0, 0, 0); ;
$tbb = imageFTText ($im, 12, 0, 50, 25, $txtcr, $font, "testing",
array());
header ("Content-type: image/png");
imagePNG($im);
imagedestroy ($im);
function LoadPNG ($imgname) {
$im = @imagecreatefrompng ($imgname); /* Attempt to open */
if (!$im) { /* See if it failed */
$im = imagecreate (150, 30); /* Create a blank image */
$bgc = imagecolorallocate ($im, 255, 255, 255);
$tc = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
?>
Expected result:
----------------
The text "testing" 50 pixels from the left of the screen.
Actual result:
--------------
The text "testing" flush to the left.
--
Edit bug report at http://bugs.php.net/?id=34733&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34733&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34733&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34733&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34733&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34733&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34733&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34733&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34733&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34733&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34733&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34733&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34733&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34733&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34733&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34733&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34733&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34733&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34733&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34733&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34733&r=mysqlcfg