Skip to content

Commit 85415ef

Browse files
author
Jack Krielen
committed
Relocate Watermark insert on image after resize. #25514
1 parent 8112a38 commit 85415ef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/code/Magento/MediaStorage/Service/ImageResize.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ private function resize(array $imageParams, string $originalImagePath, string $o
311311
]
312312
);
313313

314+
if ($imageParams['image_width'] !== null && $imageParams['image_height'] !== null) {
315+
$image->resize($imageParams['image_width'], $imageParams['image_height']);
316+
}
317+
314318
if (isset($imageParams['watermark_file'])) {
315319
if ($imageParams['watermark_height'] !== null) {
316320
$image->setWatermarkHeight($imageParams['watermark_height']);
@@ -331,9 +335,6 @@ private function resize(array $imageParams, string $originalImagePath, string $o
331335
$image->watermark($this->getWatermarkFilePath($imageParams['watermark_file']));
332336
}
333337

334-
if ($imageParams['image_width'] !== null && $imageParams['image_height'] !== null) {
335-
$image->resize($imageParams['image_width'], $imageParams['image_height']);
336-
}
337338
$image->save($imageAsset->getPath());
338339

339340
if ($this->fileStorageDatabase->checkDbUsage()) {

0 commit comments

Comments
 (0)