Edit report at https://bugs.php.net/bug.php?id=61319&edit=1
ID: 61319
User updated by: lior dot kuyer at gfk dot com
Reported by: 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
Status: Open
Type: Bug
Package: GD related
Operating System: Open suse
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
updated summary
Previous Comments:
------------------------------------------------------------------------
[2012-03-07 15:01:24] lior dot kuyer at gfk dot com
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);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61319&edit=1