Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top