[英]Paperclip is not saving the original file when a style is defined
我正在努力让 Paperclip 除了原始图像之外还存储缩略图。 原始图像一直保存文件,现在我正在尝试添加缩略图。
问题是,一旦我定义了样式缩略图,就不再保存原始样式。 我怎样才能得到原件和拇指一起保存?
has_mongoid_attached_file :attachment,
:storage => :s3,
:s3_credentials => "s3.yml",
:s3_protocol => 'https',
:s3_permissions => :private,
:use_timestamp => true,
:default_style => :original,
:default_url => '/images/:attachment/default_:style.png',
:path => "/:rails_env/private/:basename.:extension",
:styles => {
:thumb => "100x100#" },
:convert_options => {
:thumb => "-quality 75 -strip" }
安装Imagemagic ( https://github.com/thoughtbot/paperclip
),然后您可以使用这样的方式将原始尺寸的照片调整为任何尺寸
<img src="#", size: '150x150'>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.