This text is replaced by the Flash movie.

PNG upload/resize trouble

While updating a component I got from cakePHP (Image Resize/Upload) I found out that it was not for my current version of PHP - it has trouble uploading PNG type image, I'm getting "Warning (2): imagepng() [function.imagepng]: gd-png: fatal libpng error: zlib error" This error only occur on servers with PHP v5.1.x or newer... so the simple solution from the code...

from
imagepng($cropped,$filename,80);
to
imagepng($cropped,$filename,8);

The third parameter is for the quality of the image to be uploaded so for png it only supports from 0 - 9, above that it will cause warnings and errors.

Tags: , ,

Leave a Reply

*