简体   繁体   English

AutoSmusher为亚马逊S3优化图像?

[英]AutoSmusher for amazon S3 to optimise images?

Any ruby implementation with paperclip to autosmush amazon s3 images? 使用回形针进行自动冲洗亚马逊s3图像的任何红宝石实现?

PS: I googled and got this: https://github.com/grosser/smusher and works pretty nicely on my local machine. PS:我用谷歌搜索并得到了这个: https//github.com/grosser/smusher并且在我的本地机器上工作得非常好。 But to use something like this on amazon s3. 但要在亚马逊s3上使用这样的东西。 It will be great to have an automated process for this and just smush newly created content. 为此创建一个自动化流程并轻松刷新新创建的内容将会非常棒。 Any ideas? 有任何想法吗?

Code I am using to some what optimise 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 optimised. 但仍可以优化静止图像。 I got the gem smusher but confused how to use it. 我得到了宝石腮红,但很困惑如何使用它。 My current page ranking as per GTmetrics is here. 我目前按照GTmetrics的页面排名就在这里。

在此输入图像描述

I have also been looking into lossless image compression with rails, and so far I think the best gem I have found is here . 我也一直在寻找使用rails的无损图像压缩,到目前为止,我认为我找到的最好的宝石就在这里 The instructions with the gem say to add a :processors option that gets passed a hash containing multiple processing options, such as :compression , which this gem defines. 带有gem的指令说添加:processors选项,它传递包含多个处理选项的哈希,例如:compression此gem定义的:compression It also requires jpgtran and optipng to be installed, which I'm not sure if Amazon S3 has. 它还需要安装jpgtran和optipng,我不确定是否有Amazon S3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM