Rails回形针 - 上传原始图片和缩略图

时间:2012-12-27 12:10:29

标签: ruby-on-rails image amazon-s3 paperclip thumbnails

我不仅要上传原始图片,甚至还要创建缩略图并将这两个文件存储在S3中。

我明白以下几行很好:

class Asset < ActiveRecord::Base
  belongs_to :component
  attr_accessible :image
  has_attached_file :image, :styles => {:original => "100x100>", 
                                    :thumb => "100x100"},
                :path => "images/:id/:style_:basename.:extension",
                :storage => :s3,
                :s3_credentials => {
                    :bucket => "xxxxxxxx",
                    :access_key_id => "xxxxxxx",
                    :secret_access_key => "xxxxxxx"
                }
end

但它只保存原始文件。怎么了?

1 个答案:

答案 0 :(得分:0)

而不是

:style_:basename.:extension

试试这个

:style.:extension