I use carrierwave and mini_magick to upload images. In development everything is fine, but in production it raises FloatDomainError (Infinity)
when i try to upload an image. I have several projects hosted at the same server and everything is fine with uploading.
I use Rails 3.0.10.
Any ideas how can i fix it? Thanks
I had the same problem. The problem is mini_magick
. If the image file it runs identify
on is erroneous, identify will output some kind of error, e.g.
identify: Corrupt JPEG data: 7929 extraneous bytes before marker 0xed `image.jpg' @ warning/jpeg.c/EmitMessage/230.
11811 8665
mini_magick
tries to parse the error message as the dimension, and the result is 0
. This results in a division by zero which results in the exception you mentioned. This is the reason why it only fails with some images.
identify
has a -quiet
options to turn off these warning messages. I have forked mini_magick at https://github.com/fschwahn/mini_magick and added the quiet option. I hope this change will be pulled in (or the problem will be fixed in a more elegant way). However, for now you can use my fork by adding the following to your Gemfile:
gem 'mini_magick', :git => 'git://github.com/fschwahn/mini_magick.git'