From 2488e6b92aee70e26743f36d65070846f75c3929 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Mon, 19 Oct 2020 21:47:42 +0200 Subject: Image: Make $pre_max{w,h} consts --- ratatoeskr/sys/models.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php index bd45d2b..1e4ef91 100644 --- a/ratatoeskr/sys/models.php +++ b/ratatoeskr/sys/models.php @@ -2125,12 +2125,12 @@ class IOError extends Exception */ class Image extends BySQLRowEnabled { + private const PRE_MAXW = 150; + private const PRE_MAXH = 100; + private $id; private $filename; - private static $pre_maxw = 150; - private static $pre_maxh = 100; - /* * Variables: Public class variables * @@ -2272,14 +2272,14 @@ class Image extends BySQLRowEnabled } $w_orig = imagesx($img); $h_orig = imagesy($img); - if (($w_orig > self::$pre_maxw) or ($h_orig > self::$pre_maxh)) { + if (($w_orig > self::PRE_MAXW) || ($h_orig > self::PRE_MAXH)) { $ratio = $w_orig / $h_orig; if ($ratio > 1) { - $w_new = round(self::$pre_maxw); - $h_new = round(self::$pre_maxw / $ratio); + $w_new = round(self::PRE_MAXW); + $h_new = round(self::PRE_MAXW / $ratio); } else { - $h_new = round(self::$pre_maxh); - $w_new = round(self::$pre_maxh * $ratio); + $h_new = round(self::PRE_MAXH); + $w_new = round(self::PRE_MAXH * $ratio); } $preview = imagecreatetruecolor($w_new, $h_new); imagecopyresized($preview, $img, 0, 0, 0, 0, $w_new, $h_new, $w_orig, $h_orig); -- cgit v1.2.3-54-g00ecf