From 13b2dbd2b0956126b0e9f3679196994ce51d4eaa Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Mon, 23 Sep 2013 14:07:03 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=B0=D1=87=D0=B5=D1=81=D1=82=D0=B2?= =?UTF-8?q?=D0=BE=20jpeg=20=D0=BF=D0=BE-=D1=83=D0=BC=D0=BE=D0=BB=D1=87?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8E=20-=2095.=20=D0=98=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=20=D0=B0=D0=BB=D0=B3=D0=BE=D1=80=D0=B8=D1=82?= =?UTF-8?q?=D0=BC=20=D1=80=D0=B5=D1=81=D0=B0=D0=B9=D0=B7=D0=B8=D0=BD=D0=B3?= =?UTF-8?q?=D0=B0=20(=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B1=D0=B5=D0=BB=D1=8B=D1=85=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=BE=D1=81=D0=BE=D0=BA)=20-=20=D0=BE=D1=82=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B5=D0=BD=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9-=D0=BE?= =?UTF-8?q?=D1=80=D0=B3=D0=B8=D0=BD=D0=B0=D0=BB=D0=BE=D0=B2.=20(=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Image.class.php | 2 +- Upload.class.php | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) 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);