rails 回形针和乘客`不被'识别'命令识别` [英] rails paperclip and passenger `is not recognized by the 'identify' command`

查看:57
本文介绍了rails 回形针和乘客`不被'识别'命令识别`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我上传照片时,我的模型验证失败,即使没有任何验证也会出错,我返回此错误:

When I upload a photo, my model fails validation, err well even without any validations I'm returned this error:

/tmp/stream20100103-13830-ywmerx-0 is not recognized by the 'identify' command. and     
/tmp/stream20100103-13830-ywmerx-0 is not recognized by the 'identify' command.

我确信这与 ImageMagick 无关,因为我已经从上传中删除了任何图像处理,而且我已经尝试上传不同的 mime 类型,例如 .txt 文件等.

I'm confident this is not related to ImageMagick because I've removed any image processing from the uploading, also I've tried uploading different mime types, like .txt files and the such.

此外,我发现了一些可能有用的东西.一篇博客文章声称将以下内容放入我的环境中(在本例中为 development.rb)

Additionally, I found something that may work. A blog post claims that putting the following in my environment (in this case development.rb)

Paperclip.options[:command_path] = "/opt/local/bin"

推荐答案

这与 ImageMagick 有关.command_path 选项需要指向安装 identify 的位置.在命令行中,您可以使用 which identify 来确定这一点.

This is related to ImageMagick. The command_path option needs to point to the location where identify is installed. From the command line, you can determine this with which identify.

$ which identify
/some/path/to/identify

之后,将 command_path 设置为该路径(在 config/environments/development.rb 中):

Afterwards, set command_path to that path (in config/environments/development.rb):

Paperclip.options[:command_path] = "/some/path/to"

这篇关于rails 回形针和乘客`不被'识别'命令识别`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆