导轨回形针和乘客`不被'识别'命令'识别

JP *_*shy 42 ruby-on-rails paperclip

当我上传照片时,我的模型未通过验证,即使没有任何验证也是错误的我已经返回此错误:

/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.
Run Code Online (Sandbox Code Playgroud)

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

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

Paperclip.options[:command_path] = "/opt/local/bin"
Run Code Online (Sandbox Code Playgroud)

Rya*_*ary 49

这与ImageMagick有关.该command_path选项需要指向identify安装的位置.从命令行,您可以使用which identify.

$ which identify
/some/path/to/identify
Run Code Online (Sandbox Code Playgroud)

然后,设置command_path为该路径(in config/environments/development.rb):

Paperclip.options[:command_path] = "/some/path/to"
Run Code Online (Sandbox Code Playgroud)


小智 15

这也可能是因为使用Paperclip较新的,不兼容的Cocainegem 版本(例如,版本2.4.x).

  • 在Gemfile中添加gem"cocaine","〜> 0.3.2",并运行bundle update cocaine为我解决了这个问题 (3认同)

小智 6

我能够通过执行以下操作来解决此问题:

brew uninstall imagemagick
brew install imagemagick
Run Code Online (Sandbox Code Playgroud)