Skip to content

Commit

Permalink
Explicitly cast the thumbnail dimensions into int
Browse files Browse the repository at this point in the history
The requested dimensions could be a result of a calculation that yields float values. `Imagick::thumbnailImage()` expects integers and will throw in PHP 8.1+ if it cannot safely cast them to int.
  • Loading branch information
dtdesign committed Aug 3, 2023
1 parent c6d66df commit d0f3304
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ public function createEmptyImage($width, $height)
*/
public function createThumbnail($maxWidth, $maxHeight, $preserveAspectRatio = true)
{
$maxHeight = (int)$maxHeight;
$maxWidth = (int)$maxWidth;

$thumbnail = clone $this->imagick;

if ($thumbnail->getImageFormat() == 'GIF') {
Expand Down

0 comments on commit d0f3304

Please sign in to comment.