From ec29d9a1183c1c5bea1d237b21e5522f936a5ace Mon Sep 17 00:00:00 2001 From: Dave Jansen Date: Mon, 14 Aug 2023 01:44:58 +0000 Subject: [PATCH] Enforce compressed image width/height is an integer. --- image_compressed.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/image_compressed.php b/image_compressed.php index fe29146..2723029 100644 --- a/image_compressed.php +++ b/image_compressed.php @@ -32,10 +32,10 @@ $raw_imagey = imagesy($raw_image); if ($raw_imagex >= $raw_imagey) { $dest_imagex = 300; - $dest_imagey = ($raw_imagey / $raw_imagex) * $dest_imagex; + $dest_imagey = intval(($raw_imagey / $raw_imagex) * $dest_imagex); } else { $dest_imagey = 200; - $dest_imagex = ($raw_imagex / $raw_imagey) * $dest_imagey; + $dest_imagex = intval(($raw_imagex / $raw_imagey) * $dest_imagey); } $dest_image = imagecreatetruecolor($dest_imagex, $dest_imagey);