I have a collection of conversions that I want applied to ALL versions. I've looked at the source for minimagick's resize_and_pad method and it looks like it yields to a block if given. How do I get that block to the method when calling 'process'?
do_everything_else = proc { |img|
img.format('jpg') do |i|
i.quality 100
i.antialias
i.background :white
i.flatten
i.unsharp '0.3x0.3+5+0'
end
}
version :croppable, :if => :new_upload? do
# This results in 'too many arguments' error...
process :resize_and_pad => [1200, 1200, 'white', 'Center', do_everything_else]
end
The answer is: process :resize_and_pad => [1200, 1200, 'white'] { |img| do_everything_else.call img }
No idea why I can't just use process :resize_and_pad => [1200, 1200, 'white'] do_everything_else
EDIT: Cancel that, nothing happens! The block isn't even run...I put a direct block in there and also put in a "raise 'WTF'.inspect" and no error popped up. I don't know if there's any way to do this...it seems the yield(img) in minimagick's methods are useless as there's no way to pass a block to the method at all by using 'process'.