回形针Amazon S3的设置与Heroku的 [英] Paperclip Amazon S3 setup with Heroku

查看:124
本文介绍了回形针Amazon S3的设置与Heroku的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

has_​​attached_file:图像:存储=> :S3,:s3_credentials => #{} RAILS_ROOT /config/s3.yml:PATH => /:款式/:文件名

我不知道是什么:PATH => /:款式/:文件名

我也想以包括样式这个附加的图像,是,是什么:路径? 我的风格是这样的::风格=> {:中等=> 275x275>中,:拇指=&​​GT; 175x155>中}

I also want to to include the style for this attached image, is that what the :path is? the style I want is this: :styles => { :medium => "275x275>", :thumb => "175x155>" }

基本上什么是怎么回事的是,我在的Heroku 设置,我不得不使用S3似乎直截了当只是不习惯这个附件约定的东西。

Basically what's going on here is that I'm setting up on heroku and I'm having to use S3 which seems straightforward just not used to this attachment convention stuff.

另外,我刚刚签署了一个S3帐户...但的Heroku 被喷出,其免费或东西。有什么处理呢?

Also, I just signed up for an S3 account... but heroku was spouting that its free or something. What's the deal with that?

推荐答案

在'路径'指定了文件,将存储在S3上的位置。因此,如果指定的附件为:

The 'path' specifies the location on S3 where the files will be stored. Thus, if you specify an attachment as:

 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"

一个样本网址为:

<一个href="http://s3.amazonaws.com/bucket/user/image/thumb/347853856.jpg">http://s3.amazonaws.com/bucket/user/image/thumb/347853856.jpg

最后,S3不是免费的(Heroku的只是指出传输/上传未在使用基于计算在内)。如果您需要了解更多信息,Heroku的文档是优秀的。

Finally, S3 is NOT free (Heroku simply states transfer / uploads are not counted in the usage based calculations). Heroku's documentation is excellent if you need further information.

这篇关于回形针Amazon S3的设置与Heroku的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆