<% if image.is_a? UploadedFile and image.filename %> <% extension = image.extension %> <% if ['jpg', 'jpeg', 'gif', 'png', 'tiff', 'svg'].include? extension %> <%= link_to '', image.view_url, :class => "search-image-pic", :style => 'background-image: url(%s)'% image.public_filename(:thumb) %> <% if image.width && image.height %> <%= javascript_tag do %> image = jQuery('script').last().parent().find('.search-image-pic'); des_width = parseInt(image.css('width')); des_height = parseInt(image.css('height')); width = <%= image.width %>; height = <%= image.height %>; scale_factor = width > height ? des_width/width : des_height/height; image.css({'width' : scale_factor*width +'px', 'height' : scale_factor*height+'px'}); <% end %> <% end %> <% elsif ['pdf'].include? extension %> <%= link_to '', image.view_url, :class => 'search-image-pic icon-application-pdf' %> <% elsif ['doc', 'docx', 'odt', 'rtf', 'txt', 'html', 'htm'].include? extension %> <%= link_to '', image.view_url, :class => 'search-image-pic icon-application-vnd-oasis-opendocument-text' %> <% elsif ['xls', 'xlsx', 'ods', 'csv', 'tsv', 'tab'].include? extension %> <%= link_to '', image.view_url, :class => 'search-image-pic icon-application-vnd-oasis-opendocument-spreadsheet' %> <% end %> <% elsif image.is_a? Gallery %> <% elsif image.is_a? Product %> <% if image.image %>
<%= link_to '', product_path(image), :class => "search-image-pic", :style => 'background-image: url(%s)'% image.default_image(:thumb) %> <%= link_to content_tag(:span, _('Zoom in')), image.image.public_filename, :class => 'zoomify-image' %>
<% else %>
<%= _('No image') %>
<% end %> <% else %>
<% end %>