fix large images in audit log

This commit is contained in:
Pete Matsyburka
2024-02-16 18:59:10 +02:00
parent 19b9ba52d4
commit bcbbf0dd42
+6
View File
@@ -28,6 +28,7 @@ module Submissions
}.freeze
RTL_REGEXP = TextUtils::RTL_REGEXP
MAX_IMAGE_HEIGHT = 100
module_function
@@ -207,6 +208,11 @@ module Submissions
width = field['type'] == 'initials' ? 100 : 200
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.formatted_text_box([{ text: '' }])
elsif field['type'].in?(%w[file payment])