3
votes

I have application using Rails 4 and Ruby 2. I started to use mongoid-paperclip and it is working fine.

I installed ImageMagick-6.8.6-8. I added Paperclip.options[:command_path] = "/usr/local/bin/" in development.rb. And I have mongoid-paperclip rmagick (~> 2.13.2) cocaine (0.5.1)

When I added "has_mongoid_attached_file :avatar, :styles => { :small => "160x160!" }" I started to get this error: Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError

Any help please I spent hours and hours without any luck.

4

4 Answers

2
votes

NOTE: This solution is for OS-X machines and imagemagick installed via "brew"

Some of my students (I teach Rails at a dev bootcamp) had the exact same problem on their Mac OS-X machines. And, the following solution fixed them all.

The Cause

The cause of the problem is that jmagemagick is compiled using a wrong GCC compiler in your box. Although it probably has compiled into an executable (binary), however, when it runs, it fails due to linking errors (it's trying to dynamically load some dependencies, ie, libraries).

The Solution

You need to reinstall imagemagick using a correct GCC. If you have a Mac, please, follow the instructions below:

  1. Open XCode program (if you don't have it, install it)
  2. Go to Preference and open "Download" tab
  3. Download "Command line tool"
  4. After download is complete, open a terminal
  5. Run "brew reinstall imagemagick"

That should do it!

0
votes

When using brew install imagemagick, it seems to install a precompiled binary that lacks TIFF support. Use this to install ImageMagick with proper TIFF support:

brew install libtiff
brew reinstall imagemagick --with-libtiff

(Credits to Groveriffic: https://stackoverflow.com/a/13150641/235297)

0
votes

1- I have the same issue, and I solved it, when i configure the dynamic linker run-time bindings to create the necessary links and cache to the most recent shared libraries using the ldconfig command.

So you need to use the following command:

sudo ldconfig /usr/local/lib

Actually, I advice to re-install imagemagick using steps at how-to-install-image-magick-and-setup-paperclip.

2- You need to add the following code in development.rb file:

Paperclip.options[:command_path] = "/usr/local/bin/"
0
votes

Running these two commands did the trick for me. Remember to use the --force since libtool is keg-only

brew install libtool --universal
brew link libtool --force