diff --git a/app/models/concerns/tiny_mce_images.rb b/app/models/concerns/tiny_mce_images.rb index 9ab9fa986..bd9cbc49e 100644 --- a/app/models/concerns/tiny_mce_images.rb +++ b/app/models/concerns/tiny_mce_images.rb @@ -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