public function cleanThumbnails($path = '')
    {
        $cleanPathInfo = new SplFileInfo(realpath($this->getDocumentRoot() . DIRECTORY_SEPARATOR . $path));

        if (strpos($cleanPathInfo->getRealPath(), $this->getDocumentRoot()) === 0) {
            if ($cleanPathInfo->isDir()) {
                // Clean thumbnails in specified directory
                $dirIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($cleanPathInfo->getRealPath()), RecursiveIteratorIterator::SELF_FIRST);

                foreach ($dirIterator as $path => $splFileObject) {
                    /* @var SplFileObject $splFileObject */
                    if (!in_array($splFileObject->getBasename(), ['.', '..'])
                        && preg_match('#.*-' . $this->getThumbnailPrefix() . '-([\w\d]+)\.(' . implode('|', $this->getAllowedExtensions()) . ')$#', $splFileObject->getBasename())
                    ) {
                        unlink($splFileObject->getRealPath());
                    }
                }

                return true;

            } elseif ($cleanPathInfo->isFile() && in_array($cleanPathInfo->getExtension(), $this->getAllowedExtensions())) {
                // Clean thumbnails for one image
                $imagePathRemExt = $cleanPathInfo->getPath() . DIRECTORY_SEPARATOR . $cleanPathInfo->getBasename('.' . $cleanPathInfo->getExtension());

                $thumbnails = glob($imagePathRemExt . '-' . $this->getThumbnailPrefix() . '-*');
                foreach ($thumbnails as $thumbnailPath) {
                    unlink($thumbnailPath);
                }

                return true;
            }
        }

        return false;
    }