How to set Paperclip to process original image?

放肆的年华 提交于 2019-12-12 18:25:02

问题


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' }

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?


回答1:


try this

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


来源:https://stackoverflow.com/questions/35415482/how-to-set-paperclip-to-process-original-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!