我正在使用paperclip在我的rails应用程序中调整图像大小,就像这样
has_attached_file :photo, :styles => { :medium => "300x300>" }
这给了我一个大小为60kb的图像,我想用回形针处理器制作一些自定义方法来减小图像的大小,我该怎么做呢?如何直接从这些过程中调用imagemagick函数? / p>
感谢
答案 0 :(得分:-1)
在我的照片模型中:
has_attached_file :picture,
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/amazon_s3.yml",
:styles => { :original => "319x228#", :thumb => "100x60#" },
:path => "article/:attachment/:id/:style/:basename.:extension",
:bucket => YAML.load_file("#{RAILS_ROOT}/config/amazon_s3.yml")[RAILS_ENV]["bucket_name"]
validates_attachment_content_type :picture, :content_type => ['image/jpeg', 'image/pjpeg', 'image/jpg', 'image/gif', 'image/png']