the*_*gah 3 ruby ruby-on-rails heroku amazon-s3 paperclip
has_attached_file :image, :storage => :s3, :s3_credentials => "#{RAILS_ROOT}/config/s3.yml", :path => "/:style/:filename"
我不确定是什么 :path => "/:style/:filename".
我还想为这个附加图像添加样式,那是什么:路径是什么?我想要的风格是这样的::styles => { :medium => "275x275>", :thumb => "175x155>" }
基本上这里发生的是我正在安装heroku并且我必须使用S3,这似乎很简单,只是不习惯这种附件约定的东西.
此外,我刚刚注册了一个S3帐户......但是它heroku正在宣传它的免费或其他东西.这有什么用?
'path'指定S3上存储文件的位置.因此,如果您将附件指定为:
has_attached_file :image,
:styles => { :medium => "275x275>", :thumb => "175x155>" },
:storage => :s3, :s3_credentials => "#{RAILS_ROOT}/config/amazon_s3.yml",
:path => "user/:attachment/:style/:id.:extension"
Run Code Online (Sandbox Code Playgroud)
示例网址将是:
http://s3.amazonaws.com/bucket/user/image/thumb/347853856.jpg
最后,S3不是免费的(Heroku只是说转移/上传不计入基于使用的计算).如果您需要更多信息,Heroku的文档非常好.
| 归档时间: |
|
| 查看次数: |
6572 次 |
| 最近记录: |