From 8766cade49b22f48a961554d935578d70581eaf5 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 23 Nov 2011 10:39:05 -0500 Subject: [PATCH] CC-3092: Station Information: not able to upload logo - Adding a return statement fixed it...I don't what was I thinking... - Some indention seems messed up, fixed it --- .../forms/customfilters/ImageSize.php | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/airtime_mvc/application/forms/customfilters/ImageSize.php b/airtime_mvc/application/forms/customfilters/ImageSize.php index 9dcfffffe..69db3cb82 100644 --- a/airtime_mvc/application/forms/customfilters/ImageSize.php +++ b/airtime_mvc/application/forms/customfilters/ImageSize.php @@ -1,42 +1,42 @@ 1) { + // img too big! create a scaled down image + $newWidth = round($origWidth / $ratio); + $newHeight = round($origHeight / $ratio); + $resized = imagecreatetruecolor($newWidth, $newHeight); + imagecopyresampled($resized, $image, 0, 0, 0, 0, $newWidth, $newHeight, $origWidth, $origHeight); + + // determine type and store to disk + $explodeResult = explode(".", $value); + $type = strtolower($explodeResult[count($explodeResult) - 1]); + $writeFunc = 'image' . $type; + if ($type == 'jpeg' || $type == 'jpg') { + imagejpeg($resized, $value, 100); + } else { + $writeFunc($resized, $value); + } } - // create a scaled down image - $newWidth = round($origWidth / $ratio); - $newHeight = round($origHeight / $ratio); - $resized = imagecreatetruecolor($newWidth, $newHeight); - imagecopyresampled($resized, $image, 0, 0, 0, 0, $newWidth, $newHeight, $origWidth, $origHeight); - - // determine type and store to disk - $explodeResult = explode(".", $value); - $type = $explodeResult[count($explodeResult) - 1]; - $writeFunc = 'image' . $type; - if($type == 'jpeg' || $type == 'jpg') { - imagejpeg($resized, $value, 100); - } else { - $writeFunc($resized, $value); - } - } + return $value; + } } ?>