Open akehat opened 9 years ago
The functions near the end of the script , imagejpeg and imagepng , also accept a third parameter for quality. Imagejpeg defaults to 75%, where you can set it to 100. imagepng is on a scale of 0-9 where 0 is no compression.
example on line 86:
switch ( $info[2] ) { case IMAGETYPE_GIF: imagegif($image_resized, $output); break; case IMAGETYPE_JPEG: imagejpeg($image_resized, $output, 100); break; case IMAGETYPE_PNG: imagepng($image_resized, $output, 0); break; default: return false; }
Thanks... though I totally forgot on which site I used this... :-)
All in all, it's a very handy script.
My issue is - I'm using it not only to cut to size, but also to save on bandwidth. I ran the function on several images for several preset sizes. In some cases, the output is the same dimension as the original, but the output size was x3 - x4 the size. (e.g. - real example: original 59kb; output 198kb . See attachments below.)
The compression needs to be improved.
Thanks!
original:
resized: