zoomifier/lib/zoomifier_helper.rb
2008-11-24 02:18:49 -06:00

14 lines
569 B
Ruby

module Zoomifier
module ViewHelpers
def zoomify_image_tag(source, options = {})
raise ArgumentError unless [:id, :width, :height].all? {|o| options[o] }
s = content_tag :div, { :id => options[:id] } do
image_tag source, options.merge({ :id => nil })
end
zoomify_path = image_path(source).gsub(/\.[^.]+$/, '')
s += javascript_tag "swfobject.embedSWF('/swf/zoomifyViewer.swf', '#{options[:id]}', '#{options[:width]}', '#{options[:height]}', '9.0.0', false, { zoomifyImagePath: '#{zoomify_path}/' });"
s
end
end
end