php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46751 imagepng causes zlib error when quality param is given
Submitted: 2008-12-04 19:18 UTC Modified: 2008-12-07 09:44 UTC
From: j-pieper at gmx dot net Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.2.6 OS: Windows Vista SP1
Private report: No CVE-ID: None
 [2008-12-04 19:18 UTC] j-pieper at gmx dot net
Description:
------------
I wanted to create png image with imagepng(). It works fine but when I add third parameter (int $quality) it causes an zlib error.

Reproduce code:
---------------
<?php

$image = imagecreatetruecolor(50, 50);
imagepng($image, null, 100);

Expected result:
----------------
50x50px image with white background

Actual result:
--------------
Warning: imagepng() [function.imagepng]: gd-png: fatal libpng error: zlib error in C:\var\www\laboratory\star\example.php on line 4

Warning: imagepng() [function.imagepng]: gd-png error: setjmp returns error condition in C:\var\www\laboratory\star\example.php on line 4

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-04 19:34 UTC] j-pieper at gmx dot net
Please ignore my white background (expected result). I removed setting background before posting because it is irrelevant for this issue.
 [2008-12-07 09:44 UTC] kalle@php.net
You are passing a wrong value to the quality parameter (see the documentation).

Ofcourse a notice could be added to make the error message more verbose.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 17:01:33 2024 UTC