PHP Fatal error: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: gd-png: fatal libpng error: zlib error in index.php on line 183
... the problem is with $quality, first time sets in gallery/index.php default line 127
$quality = 80;
... because images generated quality for JPG images is a range from 1 (low quality) to 100 (high quality), and for PNG the range is 1 to 9 and 0 for no change.
So, in the part where its generating images in png line should be set to 0 (i had set jpg quality to 100 also, $quality = 100;)
switch ($format) {
case 'gif':
$imagnam = 'temp/' . $namefile . '.temp.gif';
ImageGif($im1, $imagnam, $quality);
echo '<img src="' . $imagnam . '" alt=""/><br/>';
break;
case 'jpg':
$imagnam = 'temp/' . $namefile . '.temp.jpg';
imageJpeg($im1, $imagnam, $quality);
echo '<img src="' . $imagnam . '" alt=""/><br/>';
break;
case 'jpeg':
$imagnam = 'temp/' . $namefile . '.temp.jpg';
imageJpeg($im1, $imagnam, $quality);
echo '<img src="' . $imagnam . '" alt=""/><br/>';
break;
case 'png':
$imagnam = 'temp/' . $namefile . '.temp.png';
imagePng($im1, $imagnam, 0);
echo '<img src="' . $imagnam . '" alt=""/><br/>';
break;
}