Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

paperclip - Imagemagick issue on Lion installed with Homebrew

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...