Bug #14350: gd cant handle some png files
| From: | martin at humany dot com | Date: | Wed, 05 Dec 2001 13:48:43 +0000 |
| Subject: | Bug #14350: gd cant handle some png files | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-72586@lists.php.net to get a copy of this message | ||
From: martin@humany.com
Operating system: win2000
PHP version: 4.0.6
PHP Bug Type: GD related
Bug description: gd cant handle some png files
(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 bug report at: http://bugs.php.net/?id=14350&edit=1