From 079c025525e3458e9d8bb9511e2b574a01927f90 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Tue, 13 May 2014 16:27:14 +0400 Subject: [PATCH] =?UTF-8?q?DIGITEC-414=20=D0=9F=D1=80=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD=D0=B0=20=D0=BA=20?= =?UTF-8?q?=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D0=BD=D0=BE=D0=B9=20=D1=81?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D0=B5=20opencart=20=D0=94=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B0=20imex-=D1=81=D0=BA?= =?UTF-8?q?=D1=80=D0=B8=D0=BF=D1=82=D0=B0=20ImageUpdate=20-=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=20?= =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=84=D0=BE?= =?UTF-8?q?=D1=82=D0=BE.=20=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=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=B8=D0=B5=20ProductModel::prepateItem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- File.class.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/File.class.php b/File.class.php index db2574f..d284ff4 100644 --- a/File.class.php +++ b/File.class.php @@ -110,6 +110,30 @@ abstract class File return (bool) $this->size; } + public function delete() + { + /** + * @var $image Image + */ + if ($this->getIsNoEmpty()) { + unlink($this->getRealPath()); + } + if (get_parent_class($this) == 'Image') { + $image = $this; + foreach ($image->variants as $size) { + $image_variant = $image->getVariant($size); + if ($image_variant->getIsNoEmpty()) { + unlink($image->getRealPath()); + } + } + } + } + + public function getRealPath() + { + return PATH_WEB_ROOT . '/' . $this->path . '/' . $this->filename; + } + /** * @return string */