开发者

Paperclip and Amazon S3 URL is too long

When the an image is stored to Amazon S3 using Paperclip the url of the image is too long:

e.g. http://s3.amazonaws.com/railsapp/Users/am/Desktop/railsapp/public/system/avatars/1/thumb/16110022.jpg?1171724004 (this is basically http://s3.amazonaws.com/[bucketname]/[path on mac to image])

This is in my user model:

  has_attached_file :avatar, 
                :styles => { :thumb => "100x100>", :medium =>"250x250>" },
                :default_style => :th开发者_运维知识库umb,
                :default_url => "/images/:attachment/missing_:style.png",
                :storage => :s3,                    
                :s3_credentials => "#{RAILS_ROOT}/config/amazon_s3.yml"

How can I make the url shorter and so that it doesn't include the long link to the file? At the same time, is there a way to prevent the original file (not the resized ones) form being saved?


Have you tried defining the :path option such as :path => "avatars/:id/:style/:filename"?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜