-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
- If an attachment is
representable?we render the attachment as an image tag representable?can be true for the following types if their related tools are installed on the system- PDF
- If the system has
popplerinstalled ->PopplerPDFPrevieweror - If the system has
muPDFinstalled ->MuPDFPreviewer
- If the system has
- Video
- If the system has
ffmpeginstalled ->VideoPreviewer
- If the system has
- PDF
- If either
popplerormuPDFis installed(Or even for video), we need to create theimage_tagas given below..
blob.preview(resize_to_limit: [100, 100])For more details => https://api.rubyonrails.org/v7.0.8/classes/ActiveStorage/Preview.html & https://api.rubyonrails.org/v7.0.8/classes/ActiveStorage/Blob/Representable.html
Proposed change
if value.try(:representable?)
if value.try(:variable?)
image_tag( @variant.nil? ? value : value.variant(@variant))
else
image_tag(value.blob.preview(resize_to_limit: [100, 100]))
end
elsif value.try(:attached?)
link_to value.blob.filename, rails_blob_path(value, disposition: :attachment)
else
""
endExample using Hunter & Co. app
Metadata
Metadata
Assignees
Labels
No labels
