php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61319 Image produced on php-5.3.3. differs from same image produced with php-5.2.5
Submitted: 2012-03-07 15:01 UTC Modified: 2015-01-18 04:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: lior dot kuyer at gfk dot com Assigned:
Status: No Feedback Package: GD related
PHP Version: 5.3.10 OS: Open suse
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-03-07 15:01 UTC] 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);



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-07 15:05 UTC] lior dot kuyer at gfk dot com
updated summary
 [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
Neither of these versions is supported any more. 

If you think that the image generation is incorrect in a supported version, please can you let us know, as well as providing the example image generated on your machine on a service like imgur.

For a lot of issues where images are generated incorrectly, the issue is dependent on your local environment so providing the image you are seeing is required to allow the issue to be investigated.
 [2015-01-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 14:01:31 2024 UTC