ID:               14350
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         GD related
 Operating System: win2000
 PHP Version:      4.0.6
 New Comment:

PHP 4.1.2-1
libgd 2.0.1-7
Apache 1.3.23-1
Linux, Debian Woody with libgd package selected from Sid

I experience problems using both ImageCopyResampled and 
ImageCopyResized on all PNGs loaded with ImageCreateFromPNG.

Source images that have a transparent background yield an all black
result image, no matter the source and destination sizes. The error is
either in ImageCreateFromPNG or the resize/resample functions, I do not
know which.

Other PNG images yield correct results when the destination size is
smaller than the source size, but generate garbage when the destination
is larger than the source.

JPEGs loaded with ImageCreateFromJpeg, on the other hand, always work.


Previous Comments:
------------------------------------------------------------------------

[2001-12-05 08:48:42] [EMAIL PROTECTED]

(Im using the official php 4.0.6 build for windows from php.net, only
extension loaded is php_imap.dll).
I've written a function to rezise images (used for making thumbnails),
it's working fine, also with png-files, but not all. Below is the code
to reproduce the problem:


jul.png is working properly, download from http://inthc.net/jul.png

gba_large.png is NOT working properly, download from
http://inthc.net/gba_large.png

(gba_large.png result in a full blue window, or a full black or gray,
it changes upon reload..)
gba_large.png was created with Paint Shop Pro 7, and displays fine in
IE, Netscape & Opera.

----snip start--
//$filename = "jul.png";
$filename = "gba_large.png";

$inImg = @ImageCreateFromPNG($filename);
if (!$inImg) { echo "Failed to open png!"; die; }

$size = GetImageSize($filename);
$srcW = $size[0]; $srcH = $size[1];
$dstW = 100; $dstH = 100;
$outImg = @ImageCreate($dstW, $dstH);
ImageCopyResampled($outImg, $inImg, 0,0,0,0, $dstW, $dstH, $srcW,
$srcH);
                
header("Content-type: image/x-png");
ImagePNG($outImg);
---snip end--

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=14350&edit=1

Reply via email to