From b5d08169e42ba6b1defe6890d9d8bc150d0b3844 Mon Sep 17 00:00:00 2001 From: Milotskiy Alexey Date: Thu, 25 Jul 2013 20:52:33 +0300 Subject: [PATCH] Added new Remover it is remove should be used in pair with Thumbnailer decorator. --- .../Resource/Remover/ThumbnailsRemover.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Zf2FileUploader/Resource/Remover/ThumbnailsRemover.php diff --git a/src/Zf2FileUploader/Resource/Remover/ThumbnailsRemover.php b/src/Zf2FileUploader/Resource/Remover/ThumbnailsRemover.php new file mode 100644 index 0000000..7bccef8 --- /dev/null +++ b/src/Zf2FileUploader/Resource/Remover/ThumbnailsRemover.php @@ -0,0 +1,29 @@ +getPath())); + /* @var $file \DirectoryIterator */ + foreach ($directory as $file) { + if ($file->isDir()) continue; + if (preg_match('/.*\_[0-9]+x[0-9]+.*/', $file->getBasename())) { + if (!unlink($file->getRealPath())) { + $result = false; + } + } + } + + return $result; + } +}