diff --git a/Image.class.php b/Image.class.php index e527a07..aa9fa5a 100644 --- a/Image.class.php +++ b/Image.class.php @@ -1,6 +1,6 @@ original_filename = $file['name']; - $greagwar_image = self::getGreagwarImage($file['tmp_name']); self::saveImage($image, $greagwar_image, $class::getMaxWidth(), $class::getMaxHeight(), $quality); if ($force_create_variants) { @@ -57,17 +56,15 @@ abstract class Upload * @param int $quality * TODO: Сделать возможность передавать параметры для метода _resize() */ - public static function saveImage($image, $greagwar_image, $width = null, $height = null, $quality = 87) + public static function saveImage($image, $greagwar_image, $width = null, $height = null, $quality = 95) { - if (!ImageVariant::getIsClass($image) && is_null($width) && is_null($height)) { - if (Image::getIsSubClass($image)) { - $width = $image::getMaxWidth(); - $height = $image::getMaxHeight(); - } - } $greagwar_image = clone($greagwar_image); if ($width || $height) { - $greagwar_image->resize($width, $height, 0xffffff, $force = true, $rescale = true, $crop = false); + if (!(ImageVariant::getIsClass($image)) && Image::getIsSubClass($image)) { + $greagwar_image->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = true); + } else { + $greagwar_image->resize($width, $height, 0xffffff, $force = true, $rescale = true, $crop = false); + } } $image->type = $greagwar_image->guessType(); $file_path = $greagwar_image->cacheFile($image->type, $quality, true);