php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59643 ImagickException:: corrupt image error/png.c/ReadPNGImage
Submitted: 2011-03-01 20:33 UTC Modified: 2015-01-18 04:22 UTC
Votes:15
Avg. Score:4.1 ± 1.3
Reproduced:13 of 14 (92.9%)
Same Version:6 (46.2%)
Same OS:5 (38.5%)
From: pecl-imagick at proneticas dot net Assigned: mkoppanen (profile)
Status: No Feedback Package: imagick (PECL)
PHP Version: 5.3.5 OS: FreeBSD uld0 8.1-RELEASE-p1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-03-01 20:33 UTC] pecl-imagick at proneticas dot net
Description:
------------
When I try to open up a PNG with Imagick() I get an error:

corrupt image `/var/tmp/magick-2u3twpg7\' @ error/png.c/ReadPNGImage/3128

But if I run:
%> identify -verbose file/image.png

There are no errors. I convert the image, etc... This happens with any PNG file. I get a similar error if I try to create a blank PNG image as well.

I have rebuilt all the libraries and ImageMagick, the error is still there. Everything else works, I can open JPGs, TIFFs, BMPs, GIFs and PDFs without errors. I can edito those files without errors, it is strictly PNG files.

Reproduce code:
---------------
<?php

$image = new Imagick('file/image.png');

?>

Expected result:
----------------
PHP Imagick PECL Class to open the png file without errors.

Actual result:
--------------
ImagickException::__set_state(array(
   'message' => 'corrupt image `/var/tmp/magick-2u3twpg7\' @ error/png.c/ReadPNGImage/3128',
   'string' => '',
   'code' => 1,
   'file' => '_img.php',
   'line' => 62,
   'trace' => 
  array (
    0 => 
    array (
      'file' => '_img.php',
      'line' => 62,
      'function' => 'readimage',
      'class' => 'Imagick',
      'type' => '->',
      'args' => 
      array (
        0 => 'file/image.png',
      ),
    ),
  ),
   'previous' => NULL,
))

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-08 02:15 UTC] gumidek at gumidek dot cz
Hi,

I have the same problem:

Fatal error: Uncaught exception 'ImagickException' with message 'corrupt image `/var/tmp/magick-gv1Ygb98' @ error/png.c/ReadPNGImage/3102' in /home/u5000/test.php:12
Stack trace:
#0 /home/u5000/test.php(12): Imagick->readimage('./obr.png')
#1 {main}
  thrown in /home/u5000/test.php on line 12

From command line I can identify and convert without errors.

This problem I have only with some png images, not all.

Ports installed:
php5-5.3.6
php-suhosin-0.9.32.1
pecl-imagick-3.0.1
ImageMagick-nox11-6.6.7.10_1
png-1.4.5
 [2011-04-08 13:20 UTC] pecl-imagick at proneticas dot net
@gumidek - I ended up trying a different server with an older version of the packages installed to get this to work. The people maintaining this PECL package are not responding to this support forum. If you find a actual fix please post here for me and anyone else dealing with this issue.

Thanks!
 [2011-04-08 15:31 UTC] mkoppanen@php.net
Your error message comes directly from ImageMagick and it's very unlikely that Imagick is doing anything in between.

The only recommendation I can give (if you installed ImageMagick from ports) is that don't as it has been causing issues in the past. I cannot reproduce this issue.
 [2011-04-08 16:49 UTC] pecl-imagick at proneticas dot net
@mkoppanen - ImageMagick converts fine and even will give me the PNG header information:

%> identify -verbose /the/specific/file/image.png

Only imagick renders the error.
 [2011-04-08 17:26 UTC] mkoppanen@php.net
Can you try with ->readImage (realpath ('./img.png')); just to exclude weird path resolving? Also does this happen just with PNG images?
 [2011-04-08 22:20 UTC] pecl-imagick at proneticas dot net
@mkoppanen - RealPath does the same, using the full path or even putting in the same directory of the script still yields the same error message.

>> Also does this happen just with PNG images?
So far yes, but not all PNGs show the errors, just random ones.
 [2011-07-18 18:10 UTC] gumidek at gumidek dot cz
Reinstaling all ports solve this problem.
 [2013-12-03 11:32 UTC] mike@php.net
-Assigned To: +Assigned To: mkoppanen
 [2015-01-05 03:00 UTC] danack@php.net
-Status: Analyzed +Status: Feedback
 [2015-01-05 03:00 UTC] danack@php.net
If this is still an issue, please can you post the image you are trying to open somewhere so that we can attempt to reproduce the issue.
 [2015-01-18 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2015-03-18 11:38 UTC] me at alanhollis dot com
Getting the same problem:

Linux classifieds1 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies


ImageMagick version => ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org

Git repo with bug/broken image

https://github.com/Alan01252/broken_png_bug-59643

To reproduce

php test.php 

Error message:

PHP Fatal error:  Uncaught exception 'ImagickException' with message 'corrupt image `2cbd0350d5c08a72911b8ca06103bb079d9e8b97e85f9571a90f55d59bd2d6a6693bfa62159791a6' @ error/png.c/ReadPNGImage/3723' ifieds.thefarmingforum.co.uk/public/common/web/upload/2c/bd/03/50/test.php on line 

Help greatly appreciated.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC