Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

compression needs to be improved #7

Open
akehat opened this issue Dec 23, 2014 · 2 comments
Open

compression needs to be improved #7

akehat opened this issue Dec 23, 2014 · 2 comments

Comments

@akehat
Copy link

akehat commented Dec 23, 2014

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:
profile_1

resized:
profile_1_225x225

@clarkmu
Copy link

clarkmu commented Mar 19, 2017

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;
}

@akehat
Copy link
Author

akehat commented Mar 20, 2017

Thanks... though I totally forgot on which site I used this... :-)

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

No branches or pull requests

2 participants