Skip to content

Commit

Permalink
fix casting float to int
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-butti committed Dec 30, 2023
1 parent 5d16816 commit 8866fc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PHPePub/Helpers/ImageHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 8866fc6

Please sign in to comment.