chore(gallery): add activestorage error catching in front
This commit is contained in:
parent
f73a1e1d54
commit
ffc0ddc446
1 changed files with 6 additions and 0 deletions
|
@ -9,13 +9,19 @@ module GalleryHelper
|
||||||
|
|
||||||
def preview_url_for(attachment)
|
def preview_url_for(attachment)
|
||||||
attachment.preview(resize_to_limit: [400, 400]).processed.url
|
attachment.preview(resize_to_limit: [400, 400]).processed.url
|
||||||
|
rescue ActiveStorage::Error
|
||||||
|
'pdf-placeholder.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
def variant_url_for(attachment)
|
def variant_url_for(attachment)
|
||||||
attachment.variant(resize_to_limit: [400, 400]).processed.url
|
attachment.variant(resize_to_limit: [400, 400]).processed.url
|
||||||
|
rescue ActiveStorage::Error
|
||||||
|
'apercu-indisponible.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
def blob_url(attachment)
|
def blob_url(attachment)
|
||||||
attachment.blob.content_type.in?(RARE_IMAGE_TYPES) ? attachment.variant(resize_to_limit: [2000, 2000]).processed.url : attachment.blob.url
|
attachment.blob.content_type.in?(RARE_IMAGE_TYPES) ? attachment.variant(resize_to_limit: [2000, 2000]).processed.url : attachment.blob.url
|
||||||
|
rescue ActiveStorage::Error
|
||||||
|
attachment.blob.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue