php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33836 1 pixel missing on imagecopyresized and imagecopyresampled
Submitted: 2005-07-23 15:04 UTC Modified: 2005-07-25 14:39 UTC
From: bug_php at yahoo dot fr Assigned: pajoye (profile)
Status: Not a bug Package: *Graphics related
PHP Version: 4.3.11 OS: Linux RedHat 2.4.28
Private report: No CVE-ID: None
 [2005-07-23 15:04 UTC] bug_php at yahoo dot fr
Description:
------------
See PHP info on http://720plan.ovh.net/test.php (PHP version is 4.3.11 as of 2005/07/23).

Bug  similar to the problem exposed in closed bug report #26254.

The code below results in an image that is 1 pixel too small: there is a blank range of pixels. According to the destination image width and height, this range of pixels can be vertical, horizontal, or both. The code below is for a 640*480 image destination. But the same happens for a 40*40 image for instance. This problem occurs with any image and number of pixels I tried. The only case it works: when the image destination has the same size thant the source image.

Reproduce code:
---------------
<html>
<body bgcolor="green">
<?
$image_source_filename="bar.jpg"; //image 230*173px
$image_cible_filename="bar.gif";
$ImgSrc = imagecreatefromjpeg ($image_source_filename);
imagetruecolortopalette($ImgSrc, false, 256);
$ImgDst = imagecreate(640,480);
imagecolorallocate($ImgDst, 255, 255, 255);
imagecopyresized($ImgDst,$ImgSrc,0,0,0,0,640,480,230,173);
imagegif ($ImgDst,$image_cible_filename);
echo("<br><br><font color=\"white\">Resized image=</font><br><img src=\"$image_cible_filename\"><br>");
?>
</body>
</html>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-23 17:39 UTC] pajoye@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Cannot reproduce, if you still have still problem, tell us if you use the bundled GD (configure --with-gd, without path to any external gd). Have tried with 5.1 and 4.4

--Pierre
 [2005-07-25 06:33 UTC] bug_php at yahoo dot fr
I'm sorry but it still doesn't work, and I don't think my code is bogus. I use the bundled GD (version 2.0 or higer) as you can see here:
http://720plan.ovh.net/test.php (this is my hosting company's website). Did you try with PHP 4.3.11?

I put my sample code here so that you can try it with various couple of width and size and see what I mean. I also put in my code a highlight_file() and a gd_info() so that you can see the actual code and various config paramaters:

http://www.demaison.com/boy.php

Thanx
 [2005-07-25 06:48 UTC] bug_php at yahoo dot fr
Oops, it seems that I don't use a bundled GD, as on phpinfo() here http://720plan.ovh.net/test.php I can see that:

 "--with-gd=/usr/local' "

Isn't it?
 [2005-07-25 08:08 UTC] pajoye@php.net
Right, you are using an extern GD.
 [2005-07-25 14:27 UTC] bug_php at yahoo dot fr
So... Did you reproduce the bug with the new details I gave to you? (See my message on 25 Jul 6:33am CEST, before the message on 25 Jul 6:48am CEST)
 [2005-07-25 14:39 UTC] pajoye@php.net
Not much I can do if you use an extern GD. Ask them to use the bundled GD. I cannot reproduce your problem using bundled GD.

You can try it using a local installation of php.

--Pierre
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed May 22 08:01:26 2019 UTC