ID: 50194 Comment by: stanislav at ww9 dot ru Reported By: stanislav at ww9 dot ru Status: Assigned Bug Type: GD related Operating System: Windows PHP Version: 5.2.11 Assigned To: pajoye New Comment:
I don't think it's a font problem. It draws text well when -the background tranparency is swiched off -alphablending is set to true -savealpha is set to false Here is the modifed code: <?php header('Content-type: image/png'); $im = imagecreatetruecolor(400, 100); $background = imagecolorallocatealpha($im, 60, 60, 60, 0)// no tranparency; $black = imagecolorallocate($im, 0, 0, 0); //imagealphablending($im, false); imagefilledrectangle($im, 0, 0, 399, 99, $background); $text = 'Tesing ... '; $font = './zeferinotwo.ttf'; imagettftext($im, 40, 0, 10, 40, $black, $font, $text); //imagesavealpha($im, true); imagepng($im); imagedestroy($im); ?> Previous Comments: ------------------------------------------------------------------------ [2009-11-20 11:42:17] f...@php.net It works with 5.2.6-1+lenny3 from Debian. Broken as well in 5.3.1 (php.net) on Debian lenny ------------------------------------------------------------------------ [2009-11-20 11:35:32] paj...@php.net I have to try them :) ------------------------------------------------------------------------ [2009-11-20 11:34:02] f...@php.net Reproduced with PHP5.3.1RC3 on Ubuntu LTS I tend to blame the font. ------------------------------------------------------------------------ [2009-11-16 20:55:55] stanislav at ww9 dot ru Description: ------------ Just wanted to write a text on an image with tranperent image and got strange result. Writing text on an image using some true type fonts like this one http://ww9.ru/zeferinotwo.ttf causes letters to overlap each other like here http://ww9.ru/test.php Reproduce code: --------------- // Set the content-type header('Content-type: image/png'); // Create the image //$im = imagecreatefromjpeg('./user/images/tpls/headbg.jpg'); $im = imagecreatetruecolor(400, 100); // Create some colors $background = imagecolorallocatealpha($im, 60, 60, 60, 127); $black = imagecolorallocate($im, 0, 0, 0); imagealphablending($im, false); imagefilledrectangle($im, 0, 0, 399, 99, $background); // The text to draw $text = 'Tesing ... '; // Replace path by your own font path $font = './zeferinotwo.ttf'; // Add the text imagettftext($im, 40, 0, 10, 40, $black, $font, $text); imagesavealpha($im, true); imagepng($im); imagedestroy($im); Expected result: ---------------- The text "Tesing ..." written on an image Actual result: -------------- http://ww9.ru/test.php ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50194&edit=1