Merge pull request #7716 from artoscinote/ma_SCI_10896

Also resize TinyMCE images for export reports [SCI-10896]
This commit is contained in:
Martin Artnik 2024-07-16 10:39:09 +02:00 committed by GitHub
commit 9c1140c3b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)