FloatDomainError (Infinity)

I use carrierwave and mini_magick to upload images. Everything is fine in development, but during production, it raises a FloatDomainError (Infinity) when I try to load an image. I have several projects hosted on the same server, and everything is fine with the download. I am using Rails 3.0.10. Any ideas how I can fix this? Thanks

+7
source share
4 answers

I had the same problem. mini_magick task. If the image file in which it runs identify on is erroneous, the identifier will throw some error, for example.

 identify: Corrupt JPEG data: 7929 extraneous bytes before marker 0xed `image.jpg' @ warning/jpeg.c/EmitMessage/230. 11811 8665 

mini_magick tries to mini_magick the error message as a dimension, and the result is 0 . This leads to division by zero, which leads to the exception you mentioned. It is for this reason that it does not work with some images.

identify has the -quiet option to disable these warning messages. I split mini_magick at https://github.com/fschwahn/mini_magick and added a quiet option. I hope this change will be dragged 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' 
+10
source

This is fixed with replacing resize_and_fill with resize_and_pad . Still do not understand his strange behavior.

+1
source

I used the Ubuntu Imagemagick version 6.7 package. I upgraded to 6.8 following the instructions here: https://askubuntu.com/questions/267746/how-can-i-install-the-latest-upstream-version-of-imagemagick-without-compiling and it worked.

+1
source

I got this error with the latest gem update when I generated a thumbnail image for my pdf file.

This code does not work:

 version :thumb do process :resize_to_fill => [260, 192] process :convert => :png process :set_content_type process :thumbnail_pdf end 

I solved this by replacing the row order. The key was that before resizing the MiniMagic , you first need to convert the thumbnail to an image, and then try to resize it.

Here is a solution that worked for me. Maybe this will help someone.

  process :convert => :png process :resize_to_fill => [260, 192] 
0
source

All Articles