<% # By default we don't allow attachment removal removable = local_assigns.fetch(:removable, false) image_size = local_assigns.fetch(:image_size, [200, 200]) %> <% if attachment.image? and attachment.variable? and !field.url_only? %> <%= link_to(field.blob_url(attachment), title: attachment.filename, class:'rounded avatar-img') do %> <%#= image_tag(field.variant(attachment, resize_to_limit: image_size),class:'avatar-img rounded delete_on_click') %> <%= image_tag attachment.variant(resize_to_limit: image_size), class:"rounded thumbnail-picture-img delete_on_click" %> <% end %> <% elsif attachment.image? and !field.url_only? %> <%= link_to(field.blob_url(attachment), title: attachment.filename) do %> <%= image_tag(field.url(attachment)) %> <% end %> <% elsif attachment.video? and attachment.previewable? and !field.url_only? %> <%# if ffmpeg is installed %> <%= video_tag(field.url(attachment), poster: field.preview(attachment, resize_to_limit: image_size), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %> <% elsif attachment.video? and !field.url_only? %> <%= video_tag(field.url(attachment), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %> <% elsif attachment.audio? and !field.url_only? %> <%= audio_tag(field.url(attachment), autoplay: false, controls: true) %> <% else %> <%= link_to(field.blob_url(attachment), title: attachment.filename) do %> <% if attachment.previewable? and !field.url_only? %> <%= image_tag(field.preview(attachment, resize_to_limit: [595, 842])) %> <% else %> <%= attachment.filename %> <% end %> <% end %> <% end %> <% if field.destroy_url.present? %> <% destroy_url = field.destroy_url.call(namespace, field.data.record, attachment) %> <% end %>