简体   繁体   English

回形针错误

[英]Paperclip Error

I'm getting the following error in my development.log我的 development.log 中出现以下错误

[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream28514-0 is not recognized by the 'identify' command.> [paperclip] 处理时收到错误:#<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream28514-0 无法被“identify”命令识别。>

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"我用谷歌搜索了这个错误,我发现很多人通过添加这一行 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). Paperclip.options[:command_path] 设置用于您的 ImageMagick 可执行文件的位置(在本例中为标识)。 Try running which identify and setting the option to be the directory that is returned.尝试运行which identify并将选项设置为返回的目录。 If that command doesn't return anything, make sure that ImageMagick is properly installed.如果该命令没有返回任何内容,请确保已正确安装 ImageMagick。

Here is what worked for me...这是对我有用的...

I uninstalled the imagemagick that i installed from the official webpage.我卸载了从官方网页安装的 imagemagick。 I reinstalled it from sudo apt-get install imagemagick我从 sudo apt-get install imagemagick 重新安装了它

then i did write Paperclip.options[:command_path] = "to/correct/path"然后我确实写了 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.当我运行“which identify”时,似乎路径是“usr/local/bin/identify”,这意味着我们应该将路径“usr/local/bin”作为我的路径。

BUT IT DIDN'T WORKED!但它没有奏效!

I surprisingly found that i identify was also in the "usr/bin" path.我出人意料地发现我的身份也在“usr/bin”路径中。 So i changed: "usr/local/bin" to "usr/bin"所以我改变了:“usr/local/bin”到“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 ).这意味着它无法在您在Paperclip.options[:command_path]指定的位置(在您的情况下为/usr/local/bin )中找到 ImageMagick 的可执行identify

This is tipically caused by two reason:这通常由两个原因引起:

  1. It might be that you actually did not installed ImageMagick.可能是您实际上没有安装 ImageMagick。
    • SOLUTION : install it:解决方案:安装它:
      • For MAC: sudo port install ImageMagick (which installs the binary release)对于 MAC: sudo port install ImageMagick (安装二进制版本)
      • For UBUNTU: sudo sudo apt-get install imagemagick对于 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.可能是您安装 ImageMagick 的位置不是/usr/local/bin而是其他位置。

    • 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) which identify (如果该标识在当前 PATH 中,应该是这样)

    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无论如何,这些文件在 Ubuntu 中的通常位置应该是/usr/bin

There are two possible problems:有两个可能的问题:

  1. Image Magick is not installed or broken Image Magick 未安装或损坏
  2. Paperclip is not able to find Image Magick Paperclip 无法找到 Image Magick

Let's take them one at a time:让我们一次拿一个:

1. Check you have Image Magick installed and it is working 1. 检查您是否安装了 Image Magick 并且它正在工作

Type:类型:

identify 

at the command line, it should work.在命令行中,它应该可以工作。 If it isn't found, or fails to work, install Image Magick.如果未找到或无法运行,请安装 Image Magick。 Did this fix it?这解决了吗? If not, continue:如果没有,请继续:

2. Help Paperclip find Image Magick 2. 帮助 Paperclip 找到 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:现在,在 production.rb 中,将以下行添加到配置块中:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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