AutoSmusher for amazon S3 for image optimization?

Any ruby ​​implementation using a clip to autorun Amazon s3 images?

PS: I googled and got this: https://github.com/grosser/smusher and it works fine on my local machine. But use something similar on amazon s3. It will be great to have an automated process for this and just grease the newly created content. Any ideas?

Code. I use some that optimize user uploaded images.

has_attached_file :attachment, { :styles => { :medium => ["654x5000000>", :jpg], :small => ["260x50000000>", :jpg], :thumb => ["75x75#", :jpg], :facebook_meta_tag =>["200x200#", :jpg] }, :convert_options => { :medium => "-quality 80 -interlace Plane", :small => "-quality 80 -interlace Plane", :thumb => "-quality 80 -interlace Plane", :facebook_meta_tag => "-quality 80 -interlace Plane" }, :s3_headers => { 'Cache-Control' => 'max-age=315576000', 'Expires' => 10.years.from_now.httpdate } }.merge(PAPERCLIP_STORAGE_OPTIONS) 

But still images can be optimized. I have a gem but am confused how to use it. The current GTmetrics ranking page is here.

enter image description here

+4
source share
1 answer

I also searched for lossless image compression using rails, and so far I find the best stone I've found is here . The pearl instructions say add a parameter :processors , which receives a hash containing several processing parameters, such as :compression , which this stone defines. It also requires the installation of jpgtran and optipng, and I'm not sure if Amazon S3 has it.

+3
source

Source: https://habr.com/ru/post/1441027/


All Articles