mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-08 21:06:24 +08:00
Merge pull request #7763 from artoscinote/ma_SCI_10931
Force ActiveStorage variant recreation when generating reports [SCI-10931]
This commit is contained in:
commit
cc24e22a1b
1 changed files with 5 additions and 4 deletions
|
@ -29,18 +29,19 @@ module TinyMceImages
|
||||||
)[0]
|
)[0]
|
||||||
next unless tm_asset_to_update
|
next unless tm_asset_to_update
|
||||||
|
|
||||||
tm_asset = tm_asset.image.representation(resize_to_limit: Constants::LARGE_PIC_FORMAT).processed
|
variant = tm_asset.image.variant(resize_to_limit: Constants::LARGE_PIC_FORMAT)
|
||||||
|
resized_asset = ActiveStorage::Variant.new(variant.blob, variant.variation).processed
|
||||||
|
|
||||||
width_attr = tm_asset_to_update.attributes['width']
|
width_attr = tm_asset_to_update.attributes['width']
|
||||||
height_attr = tm_asset_to_update.attributes['height']
|
height_attr = tm_asset_to_update.attributes['height']
|
||||||
|
|
||||||
if width_attr && height_attr && (width_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[0] ||
|
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])
|
height_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[1])
|
||||||
width_attr.value = tm_asset.image.blob.metadata['width'].to_s
|
width_attr.value = resized_asset.image.blob.metadata['width'].to_s
|
||||||
height_attr.value = tm_asset.image.blob.metadata['height'].to_s
|
height_attr.value = resized_asset.image.blob.metadata['height'].to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
tm_asset_to_update.attributes['src'].value = convert_to_base64(tm_asset.image)
|
tm_asset_to_update.attributes['src'].value = convert_to_base64(resized_asset)
|
||||||
description = html_description.css('body').inner_html.to_s
|
description = html_description.css('body').inner_html.to_s
|
||||||
end
|
end
|
||||||
description
|
description
|
||||||
|
|
Loading…
Add table
Reference in a new issue