zoomifier/lib/zoomifier_helper.rb

14 lines
569 B
Ruby
Raw Normal View History

module Zoomifier
module ViewHelpers
2008-11-24 04:41:10 +00:00
def zoomify_image_tag(source, options = {})
2008-11-24 08:18:49 +00:00
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
2008-11-24 08:18:49 +00:00
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