From PHP 4 to PHP 5.. PHP Fatal zlib error: imagepng()

Getting this error?

PHP Fatal error: imagepng() [function.imagepng]: gd-png: fatal libpng error: zlib error in example.php on line 10

Fix it easily by changing your compression variable of imagepng, imagegif or imagejpg/imagejpeg into a 1-10 ranged number – instead of the PHP 4 1-100 standard.

It should work smoothly now :)

Like this site? Subscribe on Facebook and follow on Twitter

Share this with friends:

Like what you've just read? Share it to your friends using your favourite service below:

Share on Stumble Upon Share on Google Share on MySpace Share on Delicious Share on Digg Share on Google Buzz Share via Reddit Share via E-Mail Share via Wordpress.com Share via Tumblr Share via Posterous Share via Newsvine

Comments:

  1. It works like heaven. Thank you.

  2. Yes…the solution works. Had the same problem while migrating from php4 to php5

    Thanks
    jatin

  3. thanks dude … my code works nicely now!

  4. Actually, 10 causes this error too. Set it to 9 to fix this problem.

  5. Hey Jamie, thanks for taking the time to post this. You came up quite high on Google for this error message. Within less than a minute of encountering it in a project I’m working on, I was able to remedy it, thanks to your post.

    Kudos!

  6. Hey, thx.. i used 7 and its works fine ^^

  7. Works with values 0-9.
    Thanks!

  8. Thanks for the fix! Tried it with 9 (after it not working with 10) and it worked like a charm. Gotta love easy solutions! Thanks again!

  9. Thank you so much! This one problem took two days of my life away :/

  10. Thank you for posting this, you’re a life saver!

Pingbacks/Trackbacks:

  1. 14th of January 2010

    [...] I googled this error and browsed through several Websites until I found this explanation: From PHP 4 to PHP 5.. PHP Fatal zlib error: imagepng() [...]

Add a Comment: