php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30942 imageCreateFromPng() gives fatal error
Submitted: 2004-11-30 13:20 UTC Modified: 2005-01-24 14:24 UTC
From: hkh at netnords dot dk Assigned: pajoye (profile)
Status: Not a bug Package: GD related
PHP Version: 4.3.8 OS: win XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hkh at netnords dot dk
New email:
PHP Version: OS:

 

 [2004-11-30 13:20 UTC] hkh at netnords dot dk
Description:
------------
Sometimes when calling imageCreateFromPng() it produces a fatal error instead of returning an empty string.


Reproduce code:
---------------
/*
 *  The code are placed inside this function 
 *  &getImage($IfilePathName)
 */
return imageCreateFromPng($IfilePathName);





Expected result:
----------------
An empty string.


After the documentation the function should return a resource on succes, and on error an empty string.



Actual result:
--------------
<b>Fatal error</b>:  imagecreatefrompng(): gd-png:  fatal libpng error: Invalid chunk length. in <b>
C:\Documents and Settings\hkh\Desktop\php\desktop\bmpNoget.inc.php</b> on line <b>98</b><br />

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-30 13:49 UTC] pajoye@php.net
Are you using the bundled gd library ("configure --with-gd" and not --with-gd=/path/to/gd).

Cannot reproduce it with all branches and 4.3.8.

--Pierre
 [2004-12-02 11:19 UTC] hkh at netnords dot dk
I found out witch pictures, who gives this error. It's png's created with acdsee (used to convert bmp's to png's). I have experinced no trouble with these png's in other programs.


I also found out, some of the png's gives a
<b>Fatal error</b>:  imagecreatefrompng(): gd-png:  fatal libpng error: Too many IDAT's found


Run a phpinfo() who tells me
   GD Version  bundled (2.0.23 compatible)  


The ini file contains this
   extension=php_gd2.dll
 [2004-12-02 11:35 UTC] pajoye@php.net
Please provide an url with these images please (if possible both bmp and png).

--Pierre
 [2004-12-02 12:01 UTC] hkh at netnords dot dk
http://www.hanskejserhansen.dk/png/

I don't have the original pictures. They was saved from a homepage via a browser (Don't know witch because i use four different) to my harddesk.

I tried to find the original pictures, but now they are jpg's not bmp's. sorry.
 [2004-12-02 13:36 UTC] pajoye@php.net
The fact is you will not be able to read these images without using another libpng (1.0.6 and later), compiled with:
   #define PNG_SETJMP_NOT_SUPPORTED
   #define PNG_ABORT()

The png files are not valid.

The fix will be to change the error to a warning and return false.

--Pierre



 [2005-01-24 09:46 UTC] pajoye@php.net
Not a developer issue. Fix your image conversion tool.


--Pierre
 [2005-01-24 14:24 UTC] hkh at netnords dot dk
Maybe the png files not are valid, but still PHP should not crash according to the manual who ways "returns an empty string on failure."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 23:01:30 2024 UTC