|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-07 15:05 UTC] lior dot kuyer at gfk dot com
[2012-03-07 15:05 UTC] lior dot kuyer at gfk dot com
-Summary: Image produced on php-5.3.3. differs from same image
roduced with php-5.2.5
+Summary: Image produced on php-5.3.3. differs from same image
produced with php-5.2.5
[2015-01-07 23:26 UTC] danack@php.net
-Status: Open
+Status: Feedback
[2015-01-07 23:26 UTC] danack@php.net
[2015-01-18 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 14:00:01 2025 UTC |
Description: ------------ Image production with gdlib has changed between php php-5.2.5 and php-5.3.3. Run the attached test script on both versions to see the difference. Test script: --------------- <?php $text = "abcdefghijklmnopqrstuvwxyz\n"; $text.= strtoupper("abcdefghijklmnopqrstuvwxyz")."\n"; $text .= "abcdefghijklmnopqrstuvwxyz\n"; $text.= strtoupper("abcdefghijklmnopqrstuvwxyz")."\n"; $text .= "abcdefghijklmnopqrstuvwxyz\n"; $text.= strtoupper("abcdefghijklmnopqrstuvwxyz")."\n"; $text .= "abcdefghijklmnopqrstuvwxyz\n"; $text.= strtoupper("abcdefghijklmnopqrstuvwxyz")."\n"; $text.= "01234567890123456789\n"; $text.= "!@#$%^&*()_+=-][}{\\|'\";:/?.>,<"; $fontdir = './'; putenv('GDFONTPATH='.$fontdir); $font = 'verdana.ttf'; $box = imagettfbbox ( 7.5 , 0 , $font , $text ); $width = abs($box[4] - $box[0]); $height = abs($box[5] - $box[1]); // Create the image $im = imagecreatetruecolor($width, $height); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, $width, $height, $white); // Add the text imagettftext($im, 7.5, 0, 1, 10, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() // Set the content-type header('Content-Type: image/png'); imagepng($im); imagedestroy($im);