Paperclip Error

让人想犯罪 __ 提交于 2019-11-29 01:42:39

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 worked me (Fedora 14 core)

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!