开发者

Ruby on Rails Avatar Paperclip::CommandNotFoundError

I've been trying to work with Paperclip. I've in开发者_JAVA技巧stalled ImageMagick. I've added the line Paperclip.options[:command_path] = "/usr/local/bin" in config/initializers/paperclip.rb.

But i'm still getting the error "Avatar Paperclip::CommandNotFoundError".

How can i possibly solve this?


First, make sure you have the rmagick gem in your Gemfile

gem 'rmagick', :require => 'RMagick'

Next, open a rails console from the command line.

$ rails c

type:

`which convert`

You should see something like

=> "/usr/bin/convert\n"

If you do, then take the path, in this case /usr/bin, and set Paperclip.options[:command_path] to that path. If you don't, you need to make sure that ImageMagick is installed. For OSX use Homebrew (http://mxcl.github.com/homebrew/) or MacPorts. For Debian systems you'll need two packages:

imagemagick
libmagick9-dev

For Redhat/rpm-based systems, you can try their packages, but they are pretty old and you'll probably be better off compiling from source.

If you've got ImageMagick already installed then you'll need to make sure the convert command is in your path.

As a side note, if the rmagick gem installs, then you should have ImageMagick already installed, you just need to figure out where it is on your system.


have you tried installing/using rMagic?


I installed ImageMagick using the Binary from Macports for Snow Leopard. The install went fine, but Paperclip wasn't finding ImageMagick and I was getting the same errors.

I added the following to config/environments/development.rb:

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

I restarted the server and everything works perfectly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜