t3-patches/patches/93090-9a7debc.patch

20 lines
915 B
Diff
Raw Normal View History

2020-12-21 13:13:42 +01:00
diff --git a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
index d7c4db4..d3621ce 100644
--- a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
+++ b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
@@ -2325,6 +2325,14 @@
*/
public function getImageScale($info, $w, $h, $options)
{
+ // Cropping may change the aspect ratio of the image.
+ // The image info is modified to represent the image size after cropping.
+ if (($options['crop'] ?? null) instanceof Area) {
+ /** @var Area $cropArea */
+ $cropArea = $options['crop'];
+ $info[0] = round($cropArea->getWidth());
+ $info[1] = round($cropArea->getHeight());
+ }
$out = [];
$max = strpos($w . $h, 'm') !== false ? 1 : 0;
if (strpos($w . $h, 'c') !== false) {