From 8866fc65018f47afb4665e6bfa6250b6ec9ba5ab Mon Sep 17 00:00:00 2001 From: Roberto Butti Date: Sat, 30 Dec 2023 23:47:56 +0100 Subject: [PATCH] fix casting float to int --- src/PHPePub/Helpers/ImageHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PHPePub/Helpers/ImageHelper.php b/src/PHPePub/Helpers/ImageHelper.php index 4b64e06..b6c8c27 100644 --- a/src/PHPePub/Helpers/ImageHelper.php +++ b/src/PHPePub/Helpers/ImageHelper.php @@ -287,11 +287,11 @@ public static function getImage($book, $imageSource): bool|array if ($ratio < 1 || empty($mime)) { if ($mime == "image/png" || ($book->isGifImagesEnabled === false && $mime == "image/gif")) { $image_o = imagecreatefromstring($image); - $image_p = imagecreatetruecolor($width * $ratio, $height * $ratio); + $image_p = imagecreatetruecolor((int) ($width * $ratio), (int) ($height * $ratio)); imagealphablending($image_p, false); imagesavealpha($image_p, true); imagealphablending($image_o, true); - imagecopyresampled($image_p, $image_o, 0, 0, 0, 0, ($width * $ratio), ($height * $ratio), $width, $height); + imagecopyresampled($image_p, $image_o, 0, 0, 0, 0, (int) ($width * $ratio), (int) ($height * $ratio), $width, $height); ob_start(); imagepng($image_p, null, 9); $image = ob_get_contents();