Imagemagick issue on Lion installed with Homebrew

三世轮回 提交于 2019-12-17 16:48:09

问题


I am trying to use the Paperclip gem on a Rails project so followed the docs and first installed Imagemagick using the Homebrew recipe.

I added to my model my attachment

has_attached_file :screenshot

This worked OK and the file uploads functioned as expected

I then wanted to add thumbnails to this, so again followed the docs and added to the model

  has_attached_file :screenshot, 
                :styles => { :medium => "300x300>",
                             :thumb => "100x100>" }

At this point the uploads no longer worked

I check the development logs and noticed this:

[32mCommand[0m :: identify -format %wx%h '/var/folders/ky/r5gsdhbn6yggbglsg727cc900000gn/T/stream20120302-60051-eh17n7.png[0]'
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError:     
/var/folders/ky/r5gsdhbn6yggbglsg727cc900000gn/T/stream20120302-60051-eh17n7.png is not recognized by the 'identify' command.>

At which point after some googling I thought it might be a problem with setting the default path as an environment variable

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

But I checked that this was correct using

which identify

And it returned this path

/usr/local/bin/identify

As expected

I then tried to run identify from the command line as a test and got this error

dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
  Referenced from: /usr/local/bin/identify
  Reason: Incompatible library version: identify requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0
Trace/BPT trap: 5

So I think my problem is not with paperclip, but rather the install of imageMagick via homebrew

I've tried everything suggested including

brew update
brew remove imagemagick
brew install imagemagick

But it hasn't helped i'm running Lion 10.7.2 and have installed the developer tools.

Any suggestions would be very much appreciated.


回答1:


I ran into the same issue. Running a software update on the operating system resolved it for me. The version of libfree is out of date. Paperclip, ImageMagick and Homebrew were all working fine.




回答2:


There's a simpler solution. Either install freetype:

brew install freetype

or, if it's already installed, then you need to recreate the links:

brew unlink freetype && brew link freetype

this will fix everything for you. Well, not everything, but it'll at least fix this problem.




回答3:


After a software update on OSX MoutainLion ImageMagick stopped working for me too, but simply following the steps taken by Chris worked:

brew update
brew remove imagemagick
brew install imagemagick



回答4:


libfreetype was missing on my Mountain Lion (10.8) installation. In this case, installing XQuartz will replace the missing lib. http://xquartz.macosforge.org/landing/




回答5:


I hope this helps to someone: After I try all these solution out there (update brew, reinstall imagemagick, unlink and link again) without success, came to my mind that Paperclip might be the issue. I just do:

 bundle update paperclip

And problem solved!

Note: imagemagick is working properly to me. When I run identify -format %wx%h /path/to/a/file from console, it works fine (I get the image's size). The 'identify' problem was happening only from my rails app.



来源:https://stackoverflow.com/questions/9537011/imagemagick-issue-on-lion-installed-with-homebrew

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!