module ActionView
module Helpers
module ImageMagickMacroHelper
def imagemagick_tag(filename_or_params, commands = nil, options = {})
image_tag_options = Hash.new.merge!(options)
image_tag_options.delete(:controller)
return image_tag(imagemagick_path(filename_or_params, commands, options), image_tag_options)
end
def imagemagick_path(filename_or_params, commands = [], options = {})
if (filename_or_params.is_a?(Hash))
return imagemagick_controller(filename_or_params).url_for_imagemagick(filename_or_params, commands)
else
return imagemagick_controller(options).url_for_imagemagick(filename_or_params, commands)
end
end
private
def imagemagick_controller(options)
options[:controller] ? (options[:controller].camelize + "Controller").constantize.new : @controller
end
end
end
end