简体   繁体   中英

Paperclip Error

I'm getting the following error in my development.log

[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream28514-0 is not recognized by the 'identify' command.>

And i've googled about this error and i found out that many people have solved this by adding this line Paperclip.options[:command_path] = "/usr/local/bin"

However, i still get the same error even after adding that line! I've tried everything possible!

Any help would be highly appreciated!

Regards,

Punit

The Paperclip.options[:command_path] setting is for the location of your ImageMagick executables (in this case identify). Try running which identify and setting the option to be the directory that is returned. If that command doesn't return anything, make sure that ImageMagick is properly installed.

Here is what worked for me...

I uninstalled the imagemagick that i installed from the official webpage. I reinstalled it from sudo apt-get install imagemagick

then i did write Paperclip.options[:command_path] = "to/correct/path"

THE PROBLEM HERE WAS...

when i ran "which identify" it appearde that the path was "usr/local/bin/identify" it means that we I was supposed to put as a path "usr/local/bin" as my path.

BUT IT DIDN'T WORKED!

I surprisingly found that i identify was also in the "usr/bin" path. So i changed: "usr/local/bin" to "usr/bin"

And that was all!

It means that it cannot find ImageMagick's executable identify on the location you specified in Paperclip.options[:command_path] (in your case /usr/local/bin ).

This is tipically caused by two reason:

  1. It might be that you actually did not installed ImageMagick.
    • SOLUTION : install it:
      • For MAC: sudo port install ImageMagick (which installs the binary release)
      • For UBUNTU: sudo sudo apt-get install imagemagick
  2. It might be that the location where you installed ImageMagick is not /usr/local/bin but something else.

    • SOLUTION : find where it is installed, or via the command:

      which identify (in case that identify is in the current PATH, as it should be)

    or via a raw find through the file system:

    find / -name identify

Anyway, the usual location for those file in Ubuntu should be /usr/bin

There are two possible problems:

  1. Image Magick is not installed or broken
  2. Paperclip is not able to find Image Magick

Let's take them one at a time:

1. Check you have Image Magick installed and it is working

Type:

identify 

at the command line, it should work. If it isn't found, or fails to work, install Image Magick. Did this fix it? If not, continue:

2. Help Paperclip find Image Magick

Type:

which identify

at the command line to get the path to the identify command. Now, in production.rb, add the following line to the configuration block:

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

Restart your server. That should fix it.

usr/bin 为我工作(Fedora 14 核心)

Try running the identify command in the command line and see if that gives you some error message. I found out that my server was missing some delegate libraries.

identify example.jpg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM