public function removeImage(Image $img) { //$img->clearCache(); $storePath = $this->getModule()->getStorePath(); $fileToRemove = $storePath . DIRECTORY_SEPARATOR . $img->filePath; if (preg_match('@\\.@', $fileToRemove) and is_file($fileToRemove)) { unlink($fileToRemove); } $img->delete(); }