ID: 29482 User updated by: troublegum at woltlab dot de Reported By: troublegum at woltlab dot de -Status: Bogus +Status: Open Bug Type: GD related Operating System: Windows XP Professional PHP Version: 5.0.0 New Comment:
I got a PNG image, that works perfectly fine with getimagesize() (means the correct values for width and height are being extracted), but imagecreatefrompng() fails to open it (with the above error message). So this is definately not an option to sort out images, that can't be open with imagecreatefrompng(). If it's not a bug, then it's certainly an improvement for future php versions. Previous Comments: ------------------------------------------------------------------------ [2004-08-04 02:06:08] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Use the getimagesize() function to validate the image first if you are unsure about the file's contents. ------------------------------------------------------------------------ [2004-08-01 15:55:51] troublegum at woltlab dot de Description: ------------ imagecreatefrompng() should not throw a fatal error when opening broken image files. Instead, a warning would be much more useful. The following code is useless as the scripts dies without any output. If I remove the @, it throws the following message: --- Fatal error: imagecreatefrompng() [function.imagecreatefrompng]: gd-png: fatal libpng error: Invalid chunk length. in F:\htdocs\bug\read.php on line 3 --- imagecreatefrompng throws a warning when opening files that are no png files ('broken.png' is not a valid PNG file) but not when the image file is a png image, bug is broken for whatever reason. --- OS: Windows XP Professional Apache: 2.0.49 PHP: 5.0.0 as apache module GD: bundled (2.0.23 compatible) PNG Support: enabled Reproduce code: --------------- <?php $filename = 'broken.png'; $imageResource = @imagecreatefrompng($filename); if (!$imageResource) { die('could not read ' . $filename . ' image'); } else { echo 'image ' . $filename . ' successfully read'; } ?> Expected result: ---------------- could not read broken.png image Actual result: -------------- Fatal error: imagecreatefrompng() [function.imagecreatefrompng]: gd-png: fatal libpng error: Invalid chunk length. in F:\htdocs\bug\read.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29482&edit=1