From b59225c6892b70998f32ab89deaf383c67bc33d8 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Mon, 16 Dec 2013 11:54:23 +0400 Subject: [PATCH] =?UTF-8?q?MIRSPORTA-73=20-=20=D0=9A=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=BE=20=D0=BA=D0=B0=D1=80=D1=82=D0=B8=D0=BD?= =?UTF-8?q?=D0=BE=D0=BA.=20=D0=A0=D0=B5=D1=81=D0=B0=D0=BC=D0=BF=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=B3=20=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=B8=D0=B7=D0=B1=D0=B2=D0=B0=D0=B8=D1=82=D1=8C=D1=81=D1=8F?= =?UTF-8?q?=20=D0=BE=D1=82=20=D1=83=D1=82=D0=B5=D1=87=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=B0=D0=BC=D1=8F=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Upload.class.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Upload.class.php b/Upload.class.php index cff16b1..84b6da1 100644 --- a/Upload.class.php +++ b/Upload.class.php @@ -1,10 +1,14 @@ original_filename = $file['name']; $greagwar_image = self::getGreagwarImage($file['tmp_name']); self::saveImage($image, $greagwar_image, $class::getMaxWidth(), $class::getMaxHeight()); + unset($greagwar_image); if ($force_create_variants) { $sizes = $image->getSizes(); foreach ($sizes as $size) { @@ -66,6 +71,7 @@ abstract class Upload } $size_parts = explode('x', $size); self::saveImage($image_variant, $greagwar_image, $size_parts[0] ? : null, $size_parts[1] ? : null); + unset($greagwar_image); $image->variants[$size] = $image_variant; if (Config::get('PYTHON_PIL_RESIZE')) { $script_file_path = Config::get('PYTHON_PIL_RESIZE')->script_file_path; @@ -88,25 +94,27 @@ abstract class Upload * @param null $height * TODO: Сделать возможность передавать параметры для метода _resize() */ - public static function saveImage($image, $greagwar_image, $width = null, $height = null) + public static function saveImage($image, $greagwar_image , $width = null, $height = null) { - $greagwar_image = clone($greagwar_image); + $greagwar_image_clone = clone($greagwar_image); + unset($greagwar_image); if ($width || $height) { if (!(ImageVariant::getIsClass($image)) && Image::getIsSubClass($image)) { - $greagwar_image->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = true); + $greagwar_image_clone->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = true); } else { - $greagwar_image->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = false); + $greagwar_image_clone->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = false); } } - $image->type = $greagwar_image->guessType(); - $file_path = $greagwar_image->cacheFile($image->type, $quality = 100, true); + $image->type = $greagwar_image_clone->guessType(); + $file_path = $greagwar_image_clone->cacheFile($image->type, $quality = 100, true); chmod($file_path, 0664); $image->size = filesize($file_path); $path_parts = pathinfo($file_path); $image->path = preg_replace('#^' . Config::get('PATH_WEB_ROOT') . '/#', '', $path_parts['dirname']); $image->filename = $path_parts['basename']; - $image->width = $greagwar_image->width(); - $image->height = $greagwar_image->height(); + $image->width = $greagwar_image_clone->width(); + $image->height = $greagwar_image_clone->height(); + unset($greagwar_image_clone); } public static function brightnessContrast($image, $value = '0x7')