|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-04 16:37 UTC] mhinck at suscom dot net
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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 23 02:00:02 2025 UTC |
And provide a short script without extern data. In your case 3-4 lines, create the image draw some text save the image. Please try with the bundled GD ("./configure --with-gd") as well.