首页 文章

Paperclip和Amazon S3 URL太长

提问于
浏览
0

使用Paperclip将图像存储到Amazon S3时,图像的URL太长:

例如http://s3.amazonaws.com/railsapp/Users/am/Desktop/railsapp/public/system/avatars/1/thumb/16110022.jpg?1171724004(这基本上是[http://s3.amazonaws.com/[bucketname]/path在Mac上映像])

这是我的用户模型:

has_attached_file :avatar, 
                :styles => { :thumb => "100x100>", :medium =>"250x250>" },
                :default_style => :thumb,
                :default_url => "/images/:attachment/missing_:style.png",
                :storage => :s3,                    
                :s3_credentials => "#{RAILS_ROOT}/config/amazon_s3.yml"

如何缩短网址并使其不包含文件的长链接?同时,有没有办法防止保存原始文件(而不是调整大小的文件)?

1 回答

  • 0

    您是否尝试过定义 :path 选项,例如 :path => "avatars/:id/:style/:filename"

相关问题