0
當使用回形針將圖像存儲到Amazon S3時,圖像的URL太長:回形針和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"
我怎樣才能使URL更短,所以它不包括長鏈接文件? 同時,有沒有辦法阻止原始文件(不是調整大小)的形式被保存?
你好,有什麼區別:路徑和:網址? – amaseuk 2010-08-13 18:46:27
剛剛嘗試 - :path =>「/avatars/:id/:style/:basename.:extension」 - 它運作良好 - 謝謝。我仍然對url的目的感到困惑 – amaseuk 2010-08-13 18:50:02
我不知道'url'作爲保存文件的效果,我認爲這只是在檢索過程中使用的東西。我從來沒有設置'url',只是'path'。 – theIV 2010-08-13 19:19:47