1

I'm using the carrier_wave and mini_magick gems along with ImageMagick in a Rails app. All versions are as current as can be.

It works fine in development mode. However, I just deployed the app and it does not work in production mode.

The problem occurs when I request mini_magick to resize an image:

rake aborted!
No such file or directory - gm identify -ping /tmp/mini_magick20120407-19273-jjzz44.jpg
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/subexec-0.2.1/lib/subexec.rb:71:in `spawn'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/subexec-0.2.1/lib/subexec.rb:71:in `spawn'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/subexec-0.2.1/lib/subexec.rb:55:in `run!'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/subexec-0.2.1/lib/subexec.rb:41:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/mini_magick-3.4/lib/mini_magick.rb:405:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/mini_magick-3.4/lib/mini_magick.rb:399:in `run_command'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/mini_magick-3.4/lib/mini_magick.rb:198:in `valid?'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/mini_magick-3.4/lib/mini_magick.rb:163:in `create'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/mini_magick-3.4/lib/mini_magick.rb:73:in `read'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/mini_magick-3.4/lib/mini_magick.rb:134:in `block in open'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/mini_magick-3.4/lib/mini_magick.rb:133:in `open'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/mini_magick-3.4/lib/mini_magick.rb:133:in `open'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/carrierwave-0.6.0/lib/carrierwave/processing/mini_magick.rb:245:in `manipulate!'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/carrierwave-0.6.0/lib/carrierwave/processing/mini_magick.rb:145:in `resize_to_fit'

When I comment out the CarrierWave request to 'resize_to_fit' the image everything works fine.

I've read where mini_magick had some problems with a race condition where the files in the /tmp directory were being deleted by the garbage collector before mini_magick could process them, but those cases seemed to deal with large images and/or cloud storage.

My image file is only 6K and everything is local, so I find it hard to believe that the garbage collector is swooping in and deleting the /tmp file before it can be resized. (But then again, I have no idea of the timing of these things, so I could be wrong.)

Can anyone help me with this?

Thanks, Larry

4

1 回答 1

3

缺少 ImageMagick

检查(在 Fedora Core/CentOS/RHEL 5 上):rpm -qa | grep ImageMagick

安装(在 Fedora Core/CentOS/RHEL 5 上):yum install ImageMagick

于 2012-04-10T19:15:46.130 回答