2

我正在使用回形针来调整我的 rails 应用程序中的图像大小,就像这样

has_attached_file :photo, :styles => { :medium => "300x300>" }

这给了我一个 60kb 大小的图像,我想使用回形针处理器制作一些自定义方法来减小图像的大小,我该怎么做以及如何直接从这些过程中调用 imagemagick 函数?

谢谢

4

1 回答 1

-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']
于 2012-06-29T09:09:59.930 回答