meghlal / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Ability to Compress ? Ie - SMUSH.IT #210

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.
I was hoping that we could pass the image through smushit as well for the 
cached images, the images are becoming larger than the original size even when 
at a smaller resolution.

Original issue reported on code.google.com by d...@wetcoast.ca on 31 Jul 2011 at 2:25

GoogleCodeExporter commented 9 years ago
Please provide an example image we can test with. 

Original comment by mmaun...@gmail.com on 5 Aug 2011 at 10:24

GoogleCodeExporter commented 9 years ago
Isn't timthumb already have it? Quality setting by using parameter 'q' in the 
query string. 
http://www.binarymoon.co.uk/2011/05/timthumb-quality-settings/

Original comment by b420...@klzlk.com on 6 Aug 2011 at 10:30

GoogleCodeExporter commented 9 years ago
Hi, while it does a great job for .JPG images, PNGs and GIFS do not get 
compressed, often larger sizes than the original - I regularly sync my cache 
directory with my local system and perform optimizations via pngcrush/RIOT 
manually, however soon I will be without internet for long periods of time and 
optimization will have to go by the wayside.

Try to run this file through timthumb - 
http://www.tiredofit.ca/images/flags/Us_Alabama.png and you'll see what I mean.

Original comment by d...@wetcoast.ca on 6 Aug 2011 at 5:22

GoogleCodeExporter commented 9 years ago
Thanks, the alabama flag you provided did a great job of demonstrating the 
problem.

I've added the option to have pngcrush or optipng (or both if you're paranoid) 
process images
generated by timthumb. The size reduction is dramatic.

The reason timthumb creates large images is because it generates images from 
scratch and php doesn't have very good optimization options. I tried various 
png filters to no avail.

You can see the new options at the top of the file. They're off by default 
because we can't assume people have pngcrush or optipng installed. 

Let me know how it works for you.

Original comment by mmaun...@gmail.com on 7 Aug 2011 at 12:56

GoogleCodeExporter commented 9 years ago
Great! This works wonderfully on my local dev box, but due to the shared 
hosting configuration not on my live server - too bad. Would I be asking too 
much if we could have the option to throw it through Smushit? 
http://imgopt.com/faq.php has a great API available to throw images through it.

Original comment by d...@wetcoast.ca on 7 Aug 2011 at 4:47

GoogleCodeExporter commented 9 years ago
I'll look into it. Reopening the bug.

Original comment by mmaun...@gmail.com on 7 Aug 2011 at 4:53

GoogleCodeExporter commented 9 years ago
I have good news and I have bad news.

Good news: Smushit support is now added.

Bad news: Smushit is down and appears to go down frequently with errors like 
""Could not get the image" or "Could not create temporary file".

This thread suggests this happens often: 
http://wordpress.org/support/topic/plugin-wp-smushit-smushit-error-failed-to-cre
ate-a-temp-dir?replies=19

If you're willing to cover server costs I'd be happy to put a remote 
compression service up like this, but I doubt folks will want to pay for this. 

Anyway the code is live, so if smushit comes back to life, you can give it a 
whirl. I've marked it as alpha in the config variables. Please let me know ASAP 
if the new code causes any probs. Thanks.

Original comment by mmaun...@gmail.com on 7 Aug 2011 at 6:09

GoogleCodeExporter commented 9 years ago
Fantastic. SmushIt has been having some downtime as of late likely due to load 
- I also found http://punypng.com/api might have an other alternative - of 
course these APIs suffer from limits 50 images per day and file size limits. 
Starts to increase the complexity once someone hits the API limit and I'm 
struggling for a way to figure out how to have it go back to the system and 
attempt to reoptimize if the limits have been hit.

Original comment by d...@wetcoast.ca on 7 Aug 2011 at 2:43

GoogleCodeExporter commented 9 years ago
I've had to yank the smushit code for now. It caused a bug that created 0 byte 
temporary files. My own fault, but I'm hesitating to put it back because 
smushit is a broken server. Sorry.

Original comment by mmaun...@gmail.com on 7 Aug 2011 at 7:55