I've been reading through the DragonFly docs and I think the before_serve clause of DragonFly's configuration is probably where I need to focus, perhaps by setting up some sort of

convert to jpeg if not jpeg

logic there. Or is there a much quicker/simpler way?

有帮助吗?

解决方案

sorry just saw this. if you want to convert the ORIGINAL to a jpeg then use a model after_assign callback - see http://markevans.github.com/dragonfly/file.Models.html#Callbacks you'd do

image_accessor :avatar do
  after_assign{|a| a.jpg! unless a.format == :jpg }
end

though actually you don't even need the "unless" bit because doing .jpg! on a jpeg won't do anything

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top