Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quality setting for PNG output #24

Closed
kulmjens opened this issue Oct 28, 2014 · 1 comment
Closed

Quality setting for PNG output #24

kulmjens opened this issue Oct 28, 2014 · 1 comment

Comments

@kulmjens
Copy link
Contributor

Hi there,

I noticed, that the quality setting ist not used when the output file type is set to PNG.
This can be achived by changing line 484 of phpthumb.class.php

ImagePNG($this->gdimg_output);

to

ImagePNG($this->gdimg_output, null, $this->thumbnailQuality);

Other than for JPG the value of the quality can only be 0-9 or -1.
See also http://php.net/manual/en/function.imagepng.php

JamesHeinrich added a commit that referenced this issue Oct 29, 2014
#24
Use "q" (thumbnailQuality) for PNG output compression, allowed values
are between 0-9 (least to most compression), also -1 is allowed as zlib
default. Values outside this range will default to compression level 6.
@JamesHeinrich
Copy link
Owner

You would appear to have an older copy of phpThumb, since that line is now line 476, but your idea is sound.
One thing to watch out for is that quality settings for ImagePNG is relatively now (PHP v5.1.2) so can only be conditionally used.
I have also added a little more checking to ensure that $this->thumbnailQuality is within the accepted range, otherwise a default value of 6 is used.

Fixed in 813c93a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants