add PDF preview in view for gallery

This commit is contained in:
Lisa Durand 2024-05-07 16:41:20 +02:00 committed by Eric Leroy-Terquem
parent 93c3761107
commit affb1820d8
No known key found for this signature in database
GPG key ID: ECE60B4C1FA2ABB3
9 changed files with 13 additions and 18 deletions

View file

@ -16,7 +16,7 @@ class ImageProcessorJob < ApplicationJob
return if ActiveStorage::Attachment.find_by(blob_id: blob.id)&.record_type == "ActiveStorage::VariantRecord"
auto_rotate(blob) if ["image/jpeg", "image/jpg"].include?(blob.content_type)
create_variants(blob) if blob.variant_required?
create_representations(blob) if blob.representation_required?
add_watermark(blob) if blob.watermark_pending?
end
@ -34,10 +34,9 @@ class ImageProcessorJob < ApplicationJob
end
end
def create_variants(blob)
def create_representations(blob)
blob.attachments.each do |attachment|
next unless attachment&.representable?
attachment.representation(resize_to_limit: [300, 300]).processed
attachment.representation(resize_to_limit: [400, 400]).processed
end
end