如何设置 Paperclip 处理原始图像? [英] How to set Paperclip to process original image?

查看:29
本文介绍了如何设置 Paperclip 处理原始图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Rails 4 项目中使用 Paperclip Gem 附加图像,然后清除所有 exif 数据,如下所示:

Using Paperclip Gem in a Rails 4 project to attach an image and then clean out all exif data, like this:

  has_attached_file :image,
    styles: lambda{ |a|
                          { 
                            large:      ['800x', :png],
                            thumb_340:  ['340x340#', :png],
                            thumb_180:  ['180x180#', :png]
                          }
                  },
    convert_options: { all: '-strip' }

问题是,convert_options 没有在原始图像上被调用.重新处理(或预处理)原始文件以确保调用 '-strip' 的最佳方法是什么?

Problem is, convert_options isn't getting called on the original image. What's the best method for reprocessing (or pre-processing) the original to make sure that '-strip' gets called?

推荐答案

试试这个

has_attached_file :image,
styles: lambda{ |a|
                      { 
                        original: {convert_options: '-strip'},
                        large:      ['800x', :png],
                        thumb_340:  ['340x340#', :png],
                        thumb_180:  ['180x180#', :png]
                      }
              }

这篇关于如何设置 Paperclip 处理原始图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆