app/views/dams_objects/zoom.html.erb
<%
@page_title = "Object | #{grabTitle}"
@cmp = params['cmp']
files_key = (@cmp != '0') ? "component_#{@cmp}_files_tesim" : "files_tesim"
@files = @document[files_key] || []
@files.each do |f|
json = JSON.parse(f)
use = json['use']
@file_id = json['id']
#image-source and image-service master files
if use == 'image-source' || use == 'document-service' || (!json['id'].blank? && json['id'].start_with?("1.") && use == 'image-service')
@quality = json['quality']
#When quality property not presented,set to image-huge for now?
if @quality.blank?
@quality = "1600x1600"
end
break
end
end
if @quality.blank? %>
<p>Error: unable to find zoomable image.</p>
<%
else
dim = @quality.split("x")
p1 = @object[0,2]
p2 = @object[2,2]
dir = p1 + "/" + p2 + "/" + @object
dir += "-#{@cmp}" if @cmp != '0'
# round image dimensions up to multiple of 256
width = 256; width *= 2 while width < dim[0].to_i
height = 256; height *= 2 while height < dim[1].to_i
%>
<style type="text/css">
html, body, #map {
width: 100%; height: 100%; padding: 0; margin: 0;
}
</style>
<div id="map"></div>
<script type="text/javascript">
var map = L.map('map').setView(new L.LatLng(0,0), 0);
L.tileLayer.zoomify('<%=Rails.configuration.zoomify_baseurl%><%=dir%>/', {
width: <%=width%>, height: <%=height%>
}).addTo(map);
</script>
<% end %>