Paperclip and S3: Multiple thumbnail sizes not saving

微笑、不失礼 提交于 2019-12-11 03:13:09

问题


I'm using Paperclip to handle image uploads for my Rails app, and it's working great when I use system storage: multiple thumbnail sizes ("styles" in Paperclip parlance) are saved to file, and I can access any of them by passing the style name to the url method.

When I set up the app to store images on S3 (using the aws-s3 gem), however, only one image is stored in my S3 bucket. For what it's worth, only the last style listed is stored. So, if in my model, I've got:

  has_attached_file :photo,
                :styles         => { :large  => "1000x1000>", 
                                     :medium => "600x600>", 
                                     :thumb  => "200x200>" },
                :storage        => :s3,
                :s3_credentials => "#{Rails.root}/config/s3.yml",
                :bucket         => AppConstants.bucket,
                :path           => "pictures/:id/:filename"

Only the "thumb" size will be saved to S3.

Has anybody encountered a similar problem? How can I fix this?


回答1:


I'm not sure why this works locally, but you didn't specify :style in your path declaration.



来源:https://stackoverflow.com/questions/7300866/paperclip-and-s3-multiple-thumbnail-sizes-not-saving

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