Skip to content

Commit 5183a00

Browse files
authored
fix(Image): Convert calculated dimensions to integer type (#58)
1 parent f9e28a8 commit 5183a00

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Utils/Image.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ public function thumbnail(int $width, int $height, int|Resample $resample = 2):
160160
}
161161

162162
if ($inputHeight > $inputWidth) {
163-
$width = floor($inputWidth * $height / $inputHeight);
163+
$width = (int)floor($inputWidth * $height / $inputHeight);
164164
} elseif ($inputWidth > $inputHeight) {
165-
$height = floor($inputHeight * $width / $inputWidth);
165+
$height = (int)floor($inputHeight * $width / $inputWidth);
166166
}
167167

168168
$this->resize($width, $height, $resample);
@@ -499,4 +499,4 @@ public function drawText(string $text, int $xPos, int $yPos, string $fontFile, i
499499

500500
$this->image->draw()->text($text, $font, $position);
501501
}
502-
}
502+
}

0 commit comments

Comments
 (0)