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 9b35d44 commit 5f6c29d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ public function getPlaceholder(ImageValue $value, array $options = []): string
foreach ($providersConfigs as $providersConfig) {
$provider = $this->providerRegistry->getProvider($providersConfig['provider']);
try {
// In /var/www/html/ibexa/vendor/imagine/imagine/src/Image/Box.php:42
// round(): Argument #1 ($num) must be of type int|float, string given
if ($value->width === '') {
$value->width = 0;
}
if ($value->height === '') {
$value->height = 0;
}
return $provider->getPlaceholder($value, $providersConfig['options']);
} catch (RuntimeException $exception) {
$this->logger->warning($exception->getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ public function load(ImageInterface $image, array $options = []): ImageInterface
$origWidth = $size->getWidth();
$origHeight = $size->getHeight();

if (null === $width || null === $height) {
if (null === $height) {
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 (null === $width) {
} elseif (! $width) {
$width = (int) (($height / $origHeight) * $origWidth);
}
}
Expand Down

0 comments on commit 5f6c29d

Please sign in to comment.