diff options
Diffstat (limited to 'forum/utils/imagecache.php')
-rw-r--r-- | forum/utils/imagecache.php | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/forum/utils/imagecache.php b/forum/utils/imagecache.php index 0c18e1a..aa86c97 100644 --- a/forum/utils/imagecache.php +++ b/forum/utils/imagecache.php @@ -4,14 +4,13 @@ include_once("config.php"); include_once($UTIL_DIR . "/ping.php"); -function rescale($image) { - - $maxwidth = 300; - $maxheight = 240; - +function rescale($image, $maxwidth = 300, $maxheight = 240) +{ $width = imagesx($image); $height = imagesy($image); + if($width <= $maxwidth && $height <= $maxheight) return $image; + $scale = 1; if($width > $maxwidth) $scale = $width / $maxwidth; if($height / $scale > $maxheight) $scale = $height / $maxheight; |