简体   繁体   English

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

[英]Rails paperclip - Upload original image and thumbnail

I'd like to upload not only the original image, even create a thumbnail and store both files in S3. 我不仅要上传原始图像,甚至还要创建缩略图并将这两个文件存储在S3中。

I understood that with the following lines it was fine: 我了解使用以下几行就可以了:

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

But it only saves the original file. 但是它仅保存原始文件。 What's wrong? 怎么了?

instead of this 代替这个

:style_:basename.:extension

try this 尝试这个

:style.:extension

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM