diff --git a/typo3/sysext/frontend/Classes/DataProcessing/GalleryProcessor.php b/typo3/sysext/frontend/Classes/DataProcessing/GalleryProcessor.php index 6ad4c9ef76..6a442a10f1 100644 --- a/typo3/sysext/frontend/Classes/DataProcessing/GalleryProcessor.php +++ b/typo3/sysext/frontend/Classes/DataProcessing/GalleryProcessor.php @@ -450,7 +450,11 @@ class GalleryProcessor implements DataProcessorInterface } else { $maxMediaWidth = (int)($galleryWidthMinusBorderAndSpacing / $this->galleryData['count']['columns']); foreach ($this->fileObjects as $key => $fileObject) { - $mediaWidth = min($maxMediaWidth, $this->getCroppedDimensionalProperty($fileObject, 'width')); + $mediaWidth = $maxMediaWidth; + $croppedWidth = $this->getCroppedDimensionalProperty($fileObject,'width'); + if($croppedWidth && $croppedWidth < $mediaWidth) { + $mediaWidth = $croppedWidth; + } $mediaHeight = floor( $this->getCroppedDimensionalProperty($fileObject, 'height') * ($mediaWidth / max($this->getCroppedDimensionalProperty($fileObject, 'width'), 1)) );