From f564411480af061d4034371b4724616f91af4484 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Wed, 26 Jun 2013 11:49:27 +0400 Subject: [PATCH 1/2] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20ErrorMessage=20-=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D0=B2=D1=8F=D0=B7=D0=B0=D0=BD=20=D1=81=D0=B2=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B3=D0=B5=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- File.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/File.class.php b/File.class.php index 4efebe2..81d2d05 100644 --- a/File.class.php +++ b/File.class.php @@ -11,7 +11,16 @@ abstract class File { public $path; + public $filename; + + public $logger; + + public function __construct() + { + $this->logger = Logger::getInstance(); + } + /** * @param array|string|null $data * @return Image @@ -24,8 +33,7 @@ abstract class File if (!is_array($data)) { $data = json_decode($data, true); if (json_last_error() != JSON_ERROR_NONE) { - //TODO: подумать над тем, чтобы субмодуль не был связан с классом приложения - вынести отдельно логгер для этого класса - ErrorMessage::log('Unable to convert json-string to array. Data ' . print_r($data, true)); + $instance->logger->log('Unable to convert json-string to array. Data ' . print_r($data, true)); } } if (is_array($data)) { From c36c64359acc556b66197031d30987094a051033 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Wed, 26 Jun 2013 12:44:10 +0400 Subject: [PATCH 2/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20imageMinCheckSize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UploadHelper.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/UploadHelper.class.php b/UploadHelper.class.php index 3251dd7..e0e2929 100644 --- a/UploadHelper.class.php +++ b/UploadHelper.class.php @@ -41,4 +41,20 @@ abstract class UploadHelper } return false; } + + /** + * @param $size + * @param $file_path + * @return bool + */ + public static function imageCheckMinSize($size, $file_path) + { + $imagesize = getimagesize($file_path); + $size_parts = explode('x', $size); + if ($imagesize[0] >= $size_parts[0] && $imagesize[1] >= $size_parts[1]) { + return true; + } else { + return false; + } + } } \ No newline at end of file