Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
> round(): Argument #1 ($num) must be of type int|float, string given
in /var/www/html/ibexa/vendor/imagine/imagine/src/Image/Box.php:42
  • Loading branch information
RemyNovactive committed Jan 29, 2024
1 parent 5c68de9 commit 1bbb225
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ public function load(ImageInterface $image, array $options = []): ImageInterface
$origWidth = $size->getWidth();
$origHeight = $size->getHeight();

if (null === $width || null === $height) {
if (null === $height) {
$height = (int) (($width / $origWidth) * $origHeight);
} elseif (null === $width) {
$width = (int) (($height / $origHeight) * $origWidth);
if (! $width || ! $height) {
// In /var/www/html/ibexa/vendor/imagine/imagine/src/Image/Box.php:42
// [TypeError]
// round(): Argument #1 ($num) must be of type int|float, string given
if (!$height && !$width) {
$height = $origWidth;
$width = $origHeight;
} elseif (!$height) {
$height = (int)(($width / $origWidth) * $origHeight);
} elseif (!$width) {
$width = (int)(($height / $origHeight) * $origWidth);
}
}

Expand Down

0 comments on commit 1bbb225

Please sign in to comment.