照片无法使用MiniMagick进行操作,也许它不是图像?错误

时间:2013-02-18 11:04:26

标签: ruby-on-rails ruby-on-rails-3 heroku minimagick

我有以下代码,它调整大小和图像,然后添加一些十六进制背景。在localhost上这是有效的,但在heroku上我得到以下错误

version :big do
  process :offer_resize_and_pad
 end

def offer_resize_and_pad
  img = resize_and_pad(600, nil, model.hex, 'Center')
  img
end

"Photo Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: Command (\"mogrify -thumbnail \"600x>\" -background \"#fff\" -gravity \"Center\" -extent \"600x\" /tmp/mini_magick20130217-2-1hts61y.jpg\") failed: {:status_code=>1, :output=>\"mogrify: Empty JPEG image (DNL not supported) / tmp / mini_magick20130217-2-1hts61y.jpg'@ jpeg.c / EmitMessage / 232。\ n \“

1 个答案:

答案 0 :(得分:0)

我使用了RMagick而不是Mini_magick,有一些语法更改,它似乎工作:)。

include CarrierWave::RMagick

def offer_resize_and_pad
  img = resize_and_pad(600, 280, model.hex, ::Magick::CenterGravity)
  img
end