简体   繁体   中英

Cover Paperclip::Errors::NotIdentifiedByImageMagickError

I've updated my mac to 10.9.2 (mavericks) and my rails / homebrew environment has fallen apart. I've battled through most of the issues but I'm stuck trying to get paperclip to use ImageMagick. It worked last week but I have changed a few things getting other things to work.

# gem file
gem "paperclip", "~> 4.1"

#model
   has_attached_file     :cover,
   :styles => { :medium => "600x300>", :thumb => "100x100>" },
   :url => "/assets/providers/:id/:style/:basename.:extension",
   :path => ":rails_root/public/assets/providers/:id/:style/:basename.:extension"

  validates_attachment_content_type :cover, :content_type => ['image/jpeg', 'image/png']
  validates_attachment_size :cover, :less_than => 5.megabytes
  before_validation :clear_cover

I'm getting the error message:

Cover Paperclip::Errors::NotIdentifiedByImageMagickError

Since there where a lot of issues after the update with libraries not installed / found i tried to install ImageMagick again but got:

Warning: imagemagick-6.8.9-1 already installed

so i tried

brew uninstall imagemagick
brew install imagemagick

which took suspiciously little time:

Already downloaded: /Library/Caches/Homebrew/imagemagick-6.8.9-1.mavericks.bottle.tar.gz
==> Pouring imagemagick-6.8.9-1.mavericks.bottle.tar.gz
🍺  /usr/local/Cellar/imagemagick/6.8.9-1: 1432 files, 22M

I've seen some suggestions around SO & the web, none of which worked:

brew install ghostscript
brew install libtool

Thanks to suggestion in comments I tried to run:

$ identify -format '%wx%h,1' 'test.jpg'

but got:

dyld: Library not loaded: /usr/local/lib/libltdl.7.dylib
Referenced from: /usr/local/bin/identify
Reason: image not found
Trace/BPT trap: 5

I'm not sure what the best fix is?

I read this post which adds a symlink to the library, but is that just a patch or a proper fix?

I tried to do:

$ brew install libtool --universal

but got

Warning: libtool-2.4.2 already installed

I ran

$ brew install imagemagick --build-from-source

and after a few troubles got that to happen, but now we get a new error:

identify: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/501.

It might be worth noting I get the exact same issue on my macbook & my desktop.

I had the same issue and found it was a problem with homebrew and some packages which werent properly linked.

Run the command:

brew doctor

in your terminal for help debugging homebrew. I had this problem as well and it gave me the output

Warning: You have unlinked kegs in your Cellar

Follow the instructions in the debug output to link these

brew link "PACKAGE NAME"

In my instance it was libpng that was not properly linked.

Note: If you get an error "'DIRECTORY PATH' is not writable." run

sudo chown -R $(whoami) 'DIRECTORY PATH'

and try again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM