diff --git a/plugins/media-action/resize/src/Extension/Resize.php b/plugins/media-action/resize/src/Extension/Resize.php index 38030498de15a..de5e763e6ebc0 100644 --- a/plugins/media-action/resize/src/Extension/Resize.php +++ b/plugins/media-action/resize/src/Extension/Resize.php @@ -72,13 +72,18 @@ public function onContentBeforeSave(BeforeSaveEvent $event): void $imgObject = new Image(imagecreatefromstring($item->data)); - if ($imgObject->getWidth() < $this->params->get('batch_width', 0) && $imgObject->getHeight() < $this->params->get('batch_height', 0)) { + $maxWidth = (int) $this->params->get('batch_width', 0); + $maxHeight = (int) $this->params->get('batch_height', 0); + if ( + !(($maxWidth && $imgObject->getWidth() > $maxWidth) + || ($maxHeight && $imgObject->getHeight() > $maxHeight)) + ) { return; } $imgObject->resize( - $this->params->get('batch_width', 0), - $this->params->get('batch_height', 0), + $maxWidth, + $maxHeight, false, Image::SCALE_INSIDE );