From bf738e366e34c330649a9f36a3b2001231230b3a Mon Sep 17 00:00:00 2001 From: deva Date: Sun, 12 Oct 2008 17:00:54 +0000 Subject: Now the file preview on images are scaled down. --- forum/utils/imagecache.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'forum/utils/imagecache.php') 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; -- cgit v1.2.3