|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-20 10:19 UTC] derick@php.net
[2005-10-20 10:20 UTC] keith dot miller at ricardo dot com
[2005-10-20 10:24 UTC] derick@php.net
[2005-10-20 17:05 UTC] keith dot miller at ricardo dot com
[2005-10-20 17:10 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 04:00:01 2025 UTC |
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.