From bb6cf73e7bc3b3163c9db019181548f5d649b461 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Tue, 16 Jul 2024 10:33:27 +0200 Subject: [PATCH] Also resize TinyMCE images for export reports [SCI-10896] --- app/models/concerns/tiny_mce_images.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/models/concerns/tiny_mce_images.rb b/app/models/concerns/tiny_mce_images.rb index 0267a17f6..9ab9fa986 100644 --- a/app/models/concerns/tiny_mce_images.rb +++ b/app/models/concerns/tiny_mce_images.rb @@ -29,17 +29,15 @@ module TinyMceImages )[0] next unless tm_asset_to_update - unless export_all - tm_asset = tm_asset.image.representation(resize_to_limit: Constants::LARGE_PIC_FORMAT).processed + tm_asset = tm_asset.image.representation(resize_to_limit: Constants::LARGE_PIC_FORMAT).processed - width_attr = tm_asset_to_update.attributes['width'] - height_attr = tm_asset_to_update.attributes['height'] + width_attr = tm_asset_to_update.attributes['width'] + height_attr = tm_asset_to_update.attributes['height'] - if width_attr && height_attr && (width_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[0] || - height_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[1]) - width_attr.value = tm_asset.image.blob.metadata['width'].to_s - height_attr.value = tm_asset.image.blob.metadata['height'].to_s - end + if width_attr && height_attr && (width_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[0] || + height_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[1]) + width_attr.value = tm_asset.image.blob.metadata['width'].to_s + height_attr.value = tm_asset.image.blob.metadata['height'].to_s end tm_asset_to_update.attributes['src'].value = convert_to_base64(tm_asset.image)