<% variant = Attachments::VARIANTS[local_assigns[:in_gallery] ? :small : :large] %> <% width = blob.metadata["width"] %> <% height = blob.metadata["height"] %> <% if blob.video? %> <%= tag.video \ src: rails_blob_path(blob), controls: true, preload: :none, style: "aspect-ratio: #{width} / #{height};", width: width, height: height %> <% elsif blob.audio? %> <% elsif blob.variable? %> <%= link_to url_for(blob.variant(variant)), data: { action: "lightbox#open:prevent", lightbox_target: "image" } do %> <%= image_tag url_for(blob.variant(variant)), width: width, height: height %> <% end %> <% elsif blob.previewable? %> <%= image_tag url_for(blob.preview(variant)), width: width, height: height %> <% else %> <%= blob.filename.extension&.downcase.presence || "unknown" %> <% end %>