所以我试图让图像裁剪在 Amazon S3 上工作,我有以下功能
def update_attributes(att)
scaled_img = Magick::ImageList.new(self.photo.to_file)
orig_img = Magick::ImageList.new(self.photo.to_file(:original))
scale = orig_img.columns.to_f / scaled_img.columns
args = [ att[:x1], att[:y1], att[:width], att[:height] ]
args = args.collect { |a| a.to_i * scale }
orig_img.crop!(*args)
orig_img.write(self.photo.to_file(:original))
self.photo.reprocess!
self.save
super(att)
end
离线工作正常,我在 Heroku + S3 上部署的所有更改都是“to_file”,我收到的错误消息是
undefined method `columns' for Magick::ImageList
我有点不够深入,所以我不确定如何调试它,任何帮助将不胜感激,我整个周末都在努力解决这个问题。