Search code examples
ruby-on-railsminimagick

CarrierWave MiniMagick resizing gives an error


I am using CarrierWave with MiniMagick to resize and uploaded file. I have the version directive in my uploader

  version :thumb do
    process :resize_to_limit => [100, 100]
  end

But when I upload the file, the operation fails. The exception I am getting is

No such file or directory - identify -ping /var/folders/Au/AuBTXIH8HzCAhKdy0jvi+k+++TI/-Tmp-/mini_magick20120906-64039-1gx1ptu.jpg

The name of the file I am uploading is hat.jpg. The /var/folders/Au/AuBTXIH8HzCAhKdy0jvi+k+++TI/-Tmp-/ directory does exist, but when I do the upload I do not see the file in question being created.

Any suggestions as to what the problem may be?

Edit: I have found that the specific issue is that MiniMagick is spawning a command to run identify, and the identify command is not being found. But it is on my system at /usr/local/bin/identify --it was installed as part of ImageMagick.For some reason MiniMagick is not picking it up.


Solution

  • Discovered that the problem was with my RubyMine IDE, not my application or ImageMagick or MiniMagick.

    It seems when the RubyMine IDE is launched (by double-clicking the RubyMine icon) it does not inherit the PATH that would exist for a terminal session. Therefore /usr/local/bin/ was not in my server path when I launched the rails server from within RubyMine.

    I am able to run my application successfully when launching the server from the command line. I also found that if I launch RubyMine from the command line (using open -a RubyMine), then the terminal session is inherited and everything works as expected.