diff --git a/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php b/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php index a7de12d..396f03e 100644 --- a/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php +++ b/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php @@ -33,7 +33,12 @@ public function applyEffect(ImageInterface $image) { */ public function transformDimensions(array &$dimensions, $uri) { if ($dimensions['width'] && $dimensions['height']) { - Image::scaleDimensions($dimensions, $this->configuration['width'], $this->configuration['height'], $this->configuration['upscale']); + $is_scaled = Image::scaleDimensions($dimensions, $this->configuration['width'], $this->configuration['height'], $this->configuration['upscale']); + + // If image is not scaled save the original dimensions. + if (!$is_scaled) { + return TRUE; + } } $dimensions['width'] = $this->configuration['width']; $dimensions['height'] = $this->configuration['height'];