【发布时间】:2012-10-08 00:58:33
【问题描述】:
现在我正在使用 Amazon S3 和 Paperclip,它允许我的用户上传与他们正在创建的事件相关联的图像。我的最终目标是因为其他人可以查看此事件,因此能够单击图像并让它提示保存到他们的计算机。截至目前,单击该链接将在浏览器窗口中打开该图像。我宁愿让它要求他们下载。所有图像仅保存在 S3 上,而非本地。如果可能,还需要隐藏暴露的 s3 url 或伪装它
这是我目前的设置
Index.html
<%= link_to 'Download Creative', event.creative.url, class: "btn btn-info" %>
Event.rb
has_attached_file :creative,
:styles => { :thumb => "150x150", :custcreative => "250x75" },
:path => ":attachment/:id/:style.:extension",
:s3_domain_url => "******.s3.amazonaws.com",
:storage => :s3,
:s3_credentials => Rails.root.join("config/s3.yml"),
:bucket => '*****',
:s3_permissions => :public_read,
:s3_protocol => "http",
:convert_options => { :all => "-auto-orient" },
:encode => 'utf8'
希望有人能帮帮我。
【问题讨论】:
标签: ruby-on-rails-3 amazon-s3 paperclip