回形针错误:NotIdentifiedByImageMagickError [英] Paperclip Error: NotIdentifiedByImageMagickError
问题描述
我已经安装了一个带有 Paperclip 的 Rails,现在可以正常工作一段时间了,但在最近的部署中它坏了.我相信它与 gemfile 更新同时发生,因为机器上的其他任何东西都没有改变.错误是:
I've had a rails install with Paperclip working just fine for a while now and in a recent deploy it has broken. I believe it coincided with a gemfile update, because nothing else on the machine has changed. The error is:
Command :: file -b --mime :file
[paperclip] Error while determining content type: Command 'file -b --mime :file' returned 1. Expected 0
这是一个我已经验证有效的 png 文件.当我在图像上运行 'file -b --mime' 时:
This is on a png file that I've verified to be valid. When I run 'file -b --mime' on the image I get:
image/png; charset=binary
我后来也得到了这个:
Command :: identify -format %wx%h :file
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/song_waveform_3010520121008-23335-165xag4.png20121008-23335-j8e18p is not recognized by the 'identify' command.>
我做了一个 which 文件,它给了我/usr/bin 所以我尝试在 production.rb 中设置 Paperclip.options[:command_path] = "/usr/bin/" 没有任何变化.
I did a which file and it gave me /usr/bin so I tried setting the Paperclip.options[:command_path] = "/usr/bin/" in production.rb with no change.
我想不出为什么会发生这种情况.也许它没有指向正确的目录?我有点迷失在这里.
I can't think of why this could be happening. Perhaps it's not pointing to the right directory? I'm a bit lost here.
推荐答案
这很可能是由可卡因 4 中的 API 更改引起的,而 Paperclip 尚未赶上.通过将此行插入您的 Gemfile 来尝试使用早期版本的可卡因:
Most likely this is caused by the API change in Cocaine 4 which Paperclip has not caught up to yet. Try using the earlier version of Cocaine by inserting this line into your Gemfile:
gem "cocaine", "= 0.3.2"
这篇关于回形针错误:NotIdentifiedByImageMagickError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!