fix large images in audit log

pull/217/head
Pete Matsyburka 2 years ago
parent 19b9ba52d4
commit bcbbf0dd42

@ -28,6 +28,7 @@ module Submissions
}.freeze }.freeze
RTL_REGEXP = TextUtils::RTL_REGEXP RTL_REGEXP = TextUtils::RTL_REGEXP
MAX_IMAGE_HEIGHT = 100
module_function module_function
@ -207,6 +208,11 @@ module Submissions
width = field['type'] == 'initials' ? 100 : 200 width = field['type'] == 'initials' ? 100 : 200
height = resized_image.height * (width.to_f / resized_image.width) height = resized_image.height * (width.to_f / resized_image.width)
if height > MAX_IMAGE_HEIGHT
width = (MAX_IMAGE_HEIGHT / height) * width
height = MAX_IMAGE_HEIGHT
end
composer.image(io, width:, height:, margin: [5, 0, 10, 0]) composer.image(io, width:, height:, margin: [5, 0, 10, 0])
composer.formatted_text_box([{ text: '' }]) composer.formatted_text_box([{ text: '' }])
elsif field['type'].in?(%w[file payment]) elsif field['type'].in?(%w[file payment])

Loading…
Cancel
Save