Wednesday, 6 June 2007

gd-png: fatal libpng error: zlib error

When upgrading php from php4 to php5, the following error occurs;

gd-png: fatal libpng error: zlib error

I've found the solution - so I thought i'd post it here to help others.

In php5, the quality range changes for imagePNG from 0-99 to 0-9. therefore you need to change your code to relect this, e.g.

imagePNG('','', 9);

(instead of imagePNG('','',90)) - I divided the quality value by 10 and then round or floor the value accordingly.

13 comments:

Seweryn Niemiec said...

Thx, that was very useful for me. I could quickly fix WP-SimpleViewer-Gallery.

Anonymous said...

thanks a lot!

Anonymous said...

Thanks Buddy
From
Adil
uomian2004@gmail.com

Anonymous said...

TNX!!!!

Andre Ribeirinho said...

That fixed it! Thank you.

Anonymous said...

I love you for this post. It could have been one of those problems that I would get stuck on for...god knows how long, and it allowed me to finish my work and get my target today. Genius!

Anonymous said...

thanks a lot!
your post was very useful!!!

Anonymous said...

на такую же ошибку наткнулся, зачем вводить такие изменения в библиотеки, не понимаю..

Anonymous said...

10x man!

Siddhartha said...

Thanks a lot.

Anonymous said...

Thanks a lot, buddy! It saved a lot of my time!

Unknown said...

Well done - saved my bacon.

Unknown said...

Thanks