Skip to content

Commit

Permalink
Merge pull request #1443 from openeuropa/EWPP-4149
Browse files Browse the repository at this point in the history
EWPP-4149: Update Publication thumbnail image style.
  • Loading branch information
upchuk authored Aug 21, 2024
2 parents 30bfcc7 + 9b74d57 commit 6e4db39
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ dependencies: { }
name: oe_theme_publication_thumbnail
label: 'Publication thumbnail'
effects:
44898002-78b0-4133-acb6-c08d5c208e01:
uuid: 44898002-78b0-4133-acb6-c08d5c208e01
id: image_scale
e3147a94-c49f-4d60-8bf4-dc8c21431d77:
uuid: e3147a94-c49f-4d60-8bf4-dc8c21431d77
id: retina_image_scale
weight: 1
data:
width: 192
height: 192
width: 600
height: 400
upscale: false
multiplier: 2
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,32 @@ function oe_theme_content_publication_post_update_30001(): void {
$display->save();
}
}

/**
* Update Publication thumbnail image style.
*/
function oe_theme_content_publication_post_update_00011(): void {
$image_style = ImageStyle::load('oe_theme_publication_thumbnail');
if (!$image_style) {
return;
}
$effects = $image_style->getEffects();
/** @var \Drupal\image\ImageEffectInterface $effect */
foreach ($effects as $effect) {
if ($effect->getPluginId() == 'image_scale') {
$image_style->deleteImageEffect($effect);
$configuration = $effect->getConfiguration();
$configuration['data']['width'] = 600;
$configuration['data']['height'] = 400;
$new_configuration = [
'id' => 'retina_image_scale',
'data' => $configuration['data'],
'weight' => $configuration['weight'],
];
$new_configuration['data']['multiplier'] = 2;
$image_style->addImageEffect($new_configuration);
$image_style->save();
break;
}
}
}

0 comments on commit 6e4db39

Please sign in to comment.