Issue Bug Closed

#106094Exception in ImageProcessingInstructions if calculated maxWidth is float

Alexander Grein 02/06/25, 09:21 updated 08/12/25, 14:35

Description

To reproduce:
Add a svg image with eg. 400 × 400 px (example image attached) as page thumbnail (via page properties using EXT:bootstrap_package). Add a menu content element “cards from subpages” to another page and select the parent page of the previous added page with the svg page thumbnail.

Open the page with the menu and you will get the following exception:
```
TYPO3\CMS\Core\Imaging\ImageProcessingInstructions::__construct(): Argument #1 ($width) must be of type int, float given, called in /var/www/html/vendor/typo3/cms-core/Classes/Imaging/ImageProcessingInstructions.php on line 231
```

The cause is a missing int cast at the returned width and height values of the static method ImageProcessingInstructions::fromCropScaleValues.

This problem can easily fixed by changing line 231-235 from this:
```
return new self(
width: $width,
height: $height,
cropArea: $cropArea,
);
```
to this:
```
return new self(
width: (int)$width,
height: (int)$height,
cropArea: $cropArea,
);
```

Reviews 4