php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11976 image_copy_resized does not work properly
Submitted: 2001-07-09 10:04 UTC Modified: 2001-08-06 08:45 UTC
From: yannbarrault at yahoo dot fr Assigned:
Status: Closed Package: GD related
PHP Version: 4.0.6 OS: windows 98 SE
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: yannbarrault at yahoo dot fr
New email:
PHP Version: OS:

 

 [2001-07-09 10:04 UTC] yannbarrault at yahoo dot fr
I used this function in  a script with PHP 4.0.5. It works very well. I installed PHP 4.0.6 and the script doesn't work anymore?
I found that it was this function who didn't work well.

Sorry about my English.

See my script:
<?
 Header("Content-type: image/png");
 $x=400;
 $y=400;
 $data=array (3, 1, 7, 2, 5, 4, 6);
 $im = imagecreate($x,$y);
 $black = ImageColorAllocate($im, 0,0,0);
 $blue = ImageColorAllocate($im, 0,36,135);
 $white = ImageColorAllocate($im, 255,255,255);
 ImageFilledRectangle($im,0,0,$x,$y,$white);
 imageline($im,0,50,$x,50,$black);
 imageline($im,$x-50,0,$x-50,$y,$black);
 for($i=0;$i<sizeof($data);$i++)
 {
         ImageFilledRectangle($im,$i*50+15,51,$i*50+40,51+$data[$i]*30,$blue);
 }
 $image=imagecreate(500,500);
 imagecopyresized($image,$im,0,0,0,0,400,400,400,400);
 Imagepng($image);
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-21 20:51 UTC] andy@php.net
Works fine for me (I am using Linux.)  Try removing the
header function (or set it to "text/html") and see if there
are any errors/warnings that are corrupting the image.
 [2001-07-23 06:24 UTC] yannbarrault at yahoo dot fr
When I removed the header function (or set it to "text/html"), I have this on my browser:
" PNG "??
If I keept "image/png" or "image/jpeg", I have a all-in black image??  
 [2001-07-23 09:33 UTC] andy@php.net
so what is the problem.  The image works now...  Just make sure
you set the header to "image/png" or whatever file type
the image is.
 [2001-07-23 11:43 UTC] yannbarrault at yahoo dot fr
My script should not draw a black image but a blue graph( blue rectangles).
Actually, with php4.0.6, my script draw a black square and with php4.0.5 my script draw a graphics with blue rectangles.
It works with php4.0.6 only if I don't use the function image_copy_resized. So In conclusion, I think that there is a problem with this function on php4.0.6 with W98 OS??
 [2001-07-24 03:08 UTC] yannbarrault at yahoo dot fr
The image result supposed to be a png image like this:

---------------------------|-
 | |  | |  | |  | |  | |   |
 | |  | |   -   | |  | |   |
 | |   -        | |  | |   |
  -              -   | |   |
                      -    |
                           |
                           |

So it is supposed to be a graph with blue rectangles and two black lines, not a black square.
 [2001-07-24 08:50 UTC] andy@php.net
exactly the result I got.  Can anybody else reproduce this?

I still think this is bogus.
 [2001-08-06 08:33 UTC] sniper@php.net
With GD 2.0.1 -> No workie.
With GD 1.8.4 -> Works fine. 

Not a bug in PHP but in the (beta) GD 2.0.1.

--Jani

(Why was the windows module compiled with beta-GD??)

 [2001-08-06 08:45 UTC] rasmus@php.net
Because GD2 is overall much much better than GD 1.x despite the fact that they are still labelling it a beta.  And yes, there may still be the odd bug or two.  In this particular case if you use imagecreatetruecolor() instead of imagecreate() it works fine.  And since you are generating a PNG image you should be using imagecreatetruecolor() anyway.  

To the original person who reported this, try asking the GD folks about this problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC