mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-05 20:23:16 +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]
|
||||
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']
|
||||
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
|
||||
width_attr.value = resized_asset.image.blob.metadata['width'].to_s
|
||||
height_attr.value = resized_asset.image.blob.metadata['height'].to_s
|
||||
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
|
||||
end
|
||||
description
|
||||
|
|
Loading…
Reference in a new issue