TutorialMS Community Forum

Full Version: BUG #7; zlib error [SOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Fatal error: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: gd-png: fatal libpng error: zlib error in /750/home/quality/public_html/tutorials/admin/includes/functions.php on line 90
I am assuming you are using PHP 5, based on this error.

Do this to get rid of the error:

1. Open /admin/includes/functions.php

On lines 82, 86, 90, 127, 131, 135, 156, 160, 164. It will look something like this

image****($image_p, '../'.$name, 100);

if the line starts with "imagegif(" remove the 100 so it looks like imagegif($image_p, '../'.$name);

if the line starts with "imagejpeg(" leave it as it is.

if the line starts with "imagepng(" replace the 100 with a 9 so it looks like imagepng($image_p, '../'.$name, 9);

2. Open /includes/functions.php

On lines 86, 90, 94 do the same thing as step 1.
hay thx work fine now
Scott Wrote:I am assuming you are using PHP 5, based on this error.

Do this to get rid of the error:

1. Open /admin/includes/functions.php

On lines 82, 86, 90, 127, 131, 135, 156, 160, 164. It will look something like this

imagegif($image_p, '../'.$name, 100);
the "imagegif" may be different (might be jpeg or png) but what you need to do for all of those lines is change the 100 to 9.

2. Open /includes/functions.php

On lines 86, 90, 94 do the same thing as step 1.

The imagegif() calls is kinda wrong, imagegif() doesn't have a 3rd parameter for quality. Only JPEG have a quality parameter which can be a value of 0-100 and as you said with the 9, then PNGs uses compression level 0-9 =)
I changed it so now

imagepng() will have quality set to 9.
imagegif() will not have a quality set.
imagejpeg() will have quality set to 100.
Reference URL's