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; + } } ?>