Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I optimize images uploaded using Paperclip & Rails?

Does anyone know how to optimize image size through paperclip?

In my Graphic model I have the following:

has_attached_file :graphic, 
                    :styles => {
                      :home       => ['120x90',:jpg],
                      :thumb      => ['70x70',:jpg]
                    }

By optimize I mean, reduce the filesize of each of :home & :thumb graphics once paperclip creates them, Google's speed test tells me that I should be able to reduce these by 70 - 90%.

I think I can do this by creating a perclip processor, but not really sure where to start.

Kind of stumped on this one, any help / hints much appreciated!

(Rails 2.3)

like image 323
Jason Avatar asked Dec 09 '25 22:12

Jason


1 Answers

There's a gem that allows you to do this easily with Paperclip:

https://github.com/janfoeh/paperclip-optimizer

like image 197
tirdadc Avatar answered Dec 11 '25 11:12

tirdadc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!