pull/382/head
Pete Matsyburka 1 year ago
parent 05647135bc
commit ff14caa9f7

@ -291,7 +291,16 @@ module Submissions
),
if field['type'].in?(%w[image signature initials stamp])
attachment = submitter.attachments.find { |a| a.uuid == value }
image = Vips::Image.new_from_buffer(attachment.download, '').autorot
image =
begin
Vips::Image.new_from_buffer(attachment.download, '').autorot
rescue Vips::Error
next unless attachment.content_type.starts_with?('image/')
next if attachment.byte_size.zero?
raise
end
scale = [600.0 / image.width, 600.0 / image.height].min

@ -19,7 +19,6 @@ module Submissions
MAX_PAGE_ROTATE = 20
A4_SIZE = [595, 842].freeze
SUPPORTED_IMAGE_TYPES = ['image/png', 'image/jpeg'].freeze
TESTING_FOOTER = 'Testing Document - NOT LEGALLY BINDING'
@ -273,7 +272,15 @@ module Submissions
attachments_data_cache[attachment.uuid] ||= attachment.download
image = Vips::Image.new_from_buffer(attachments_data_cache[attachment.uuid], '').autorot
image =
begin
Vips::Image.new_from_buffer(attachments_data_cache[attachment.uuid], '').autorot
rescue Vips::Error
next unless attachment.content_type.starts_with?('image/')
next if attachment.byte_size.zero?
raise
end
scale = [(area['w'] * width) / image.width,
(area['h'] * height) / image.height].min

Loading…
Cancel
Save