3

我有使用 Rails 4 和 Ruby 2 的应用程序。我开始使用 mongoid-paperclip,它工作正常。

我安装了 ImageMagick-6.8.6-8。我在 development.rb 中添加了 Paperclip.options[:command_path] = "/usr/local/bin/"。我有 mongoid-paperclip rmagick (~> 2.13.2) 可卡因 (0.5.1)

当我添加“has_mongoid_attached_file :avatar, :styles => { :small => "160x160!" }”时,我开始收到此错误:Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError

任何帮助请我花了几个小时没有任何运气。

4

4 回答 4

2

NOTE: This solution is for OS-X machines and imagemagick installed via "brew"

Some of my students (I teach Rails at a dev bootcamp) had the exact same problem on their Mac OS-X machines. And, the following solution fixed them all.

The Cause

The cause of the problem is that jmagemagick is compiled using a wrong GCC compiler in your box. Although it probably has compiled into an executable (binary), however, when it runs, it fails due to linking errors (it's trying to dynamically load some dependencies, ie, libraries).

The Solution

You need to reinstall imagemagick using a correct GCC. If you have a Mac, please, follow the instructions below:

  1. Open XCode program (if you don't have it, install it)
  2. Go to Preference and open "Download" tab
  3. Download "Command line tool"
  4. After download is complete, open a terminal
  5. Run "brew reinstall imagemagick"

That should do it!

于 2013-12-06T19:05:28.927 回答
0

1-当我配置动态链接器运行时绑定以创建必要的链接并使用ldconfig 命令缓存到最新的共享库时,我遇到了同样的问题,并且我解决了它。

所以你需要使用以下命令:

sudo ldconfig /usr/local/lib

实际上,我建议使用how-to-install-image-magick-and-setup-paperclip中的步骤重新安装 imagemagick 。

2-您需要在development.rb文件中添加以下代码:

Paperclip.options[:command_path] = "/usr/local/bin/"
于 2014-12-16T11:42:38.840 回答
0

运行这两个命令对我有用。记住要使用 --force 因为 libtool 是仅限小桶的

brew install libtool --universal
brew link libtool --force
于 2015-04-13T06:49:34.893 回答
0

使用时brew install imagemagick,它似乎安装了一个缺乏 TIFF 支持的预编译二进制文件。使用它来安装具有适当 TIFF 支持的 ImageMagick:

brew install libtiff
brew reinstall imagemagick --with-libtiff

(归功于 Groveriffic:https ://stackoverflow.com/a/13150641/235297 )

于 2014-07-16T19:29:29.413 回答