public static function resize($path = false, $width = false, $height = false, $save = false) { require_once ROOT_PATH . "class/editor/filemanager/include/php_image_magician.php"; require_once ROOT_PATH . "class/editor/filemanager/include/utils.php"; switch (true) { case (empty($width) || $width == 'auto') && (empty($height) || $height == 'auto'): return false; break; case empty($width) || $width == 'auto': $option = 1; break; case empty($height) || $height == 'auto': $option = 2; break; default: $option = 0; break; } $path = str_replace(CORE::$cfg['host'], ROOT_PATH, $path); $magicianObj = new imageLib($path); #$magicianObj->setForceStretch(false); $magicianObj->resizeImage($width, $height, $option); #$imagick = new Imagick($path); #$imagick->resizeImage($width,$height,Imagick::FILTER_LANCZOS,false); #$imagick->scaleImage($width,$height); $filename = basename($path); $file_extension = strtolower(substr(strrchr($filename, "."), 1)); /* switch($file_extension){ case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpeg": case "jpg": $ctype="image/jpeg"; break; default: } header('Content-type: '.$ctype); */ #echo $imagick->getImageBlob(); if (empty($save)) { $magicianObj->displayImage($file_extension); } else { $magicianObj->saveImage($save, 100); } }