fix(gallery): display pdf previews without ImageMagick and pdftoppm installed in web machines
This commit is contained in:
parent
fcb868c6a8
commit
6888a3da94
1 changed files with 2 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module GalleryHelper
|
module GalleryHelper
|
||||||
def displayable_pdf?(blob)
|
def displayable_pdf?(blob)
|
||||||
blob.previewable? && blob.content_type.in?(AUTHORIZED_PDF_TYPES)
|
blob.content_type.in?(AUTHORIZED_PDF_TYPES)
|
||||||
end
|
end
|
||||||
|
|
||||||
def displayable_image?(blob)
|
def displayable_image?(blob)
|
||||||
|
@ -16,8 +16,7 @@ module GalleryHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def preview_url_for(attachment)
|
def preview_url_for(attachment)
|
||||||
preview = attachment.preview(resize_to_limit: [400, 400])
|
attachment.blob.preview_image.url.presence || 'pdf-placeholder.png'
|
||||||
preview.image.attached? ? preview.processed.url : 'pdf-placeholder.png'
|
|
||||||
rescue StandardError
|
rescue StandardError
|
||||||
'pdf-placeholder.png'
|
'pdf-placeholder.png'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue