diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-10-19 21:47:42 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-10-19 21:47:42 +0200 |
commit | 2488e6b92aee70e26743f36d65070846f75c3929 (patch) | |
tree | 855a51c072daaaa12ad1ea46a206c4ba1a8631d1 /ratatoeskr | |
parent | 1deb6a003e09181fad5d64e775af37d95e7447f7 (diff) | |
download | ratatoeskr-cms-2488e6b92aee70e26743f36d65070846f75c3929.tar.gz ratatoeskr-cms-2488e6b92aee70e26743f36d65070846f75c3929.tar.bz2 ratatoeskr-cms-2488e6b92aee70e26743f36d65070846f75c3929.zip |
Image: Make $pre_max{w,h} consts
Diffstat (limited to 'ratatoeskr')
-rw-r--r-- | ratatoeskr/sys/models.php | 16 |
1 files 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); |