现在我正在使用Amazon S3和Paperclip,它允许我的用户上传与他们正在创建的事件相关联的图像.我的最终目标是,因为其他人可以查看此事件,以便能够点击图像并让它提示保存到他们的计算机.截至目前,单击该链接将在浏览器窗口中打开图像.我宁愿让它要求他们下载.所有图像仅保存在S3上,而不是本地.如果可能,也需要隐藏暴露的s3网址或伪装它
这是我目前的设置
的index.html
<%= link_to 'Download Creative', event.creative.url, class: "btn btn-info" %>
Run Code Online (Sandbox Code Playgroud)
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'
Run Code Online (Sandbox Code Playgroud)
希望有人可以帮助我.