开发者

Dragonfly Gem with ImageMagick and Passenger

I was having some problems getting the dragonfly gem to play nicely with passenger. Passenger doesn't seem to use the current $P开发者_高级运维ATH so it can't find the convert binary. I've added some configuration to dragonfly which seems to solve the issue:

require 'dragonfly/rails/images'

Dragonfly[:images].configure do |c|
  c.convert_command  = "/usr/local/bin/convert" # defaults to "convert"
  c.identify_command = "/usr/local/bin/convert" # defaults to "convert"
end

but the gem i'm working on is going to be used as an engine and it's going to be a real pain to have to manually set the location to the imagemagick utilities for each install if passenger is used, is there a better solution to automatically specify the location to convert if available?


Hey mario, try something like this. I've been using it to resolve pathing problems with passenger+paperclip+rmagick.

path = `which convert`.strip.gsub('convert','').presence || "/usr/local/bin/"

It should return /usr/local/bin when convert isn't in the path or unable to be found.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜