public static function ImageDelete() { $get_blog_image = SmartBlogPost::getBlogImage(); $get_author_image = __PS_BASE_URI__ . 'modules/smartblog/images/avatar/avatar.jpg'; $get_cate_image = BlogCategory::getCatImage(); $category_types = BlogImageType::GetImageAllType('category'); $posts_types = BlogImageType::GetImageAllType('post'); $author_types = BlogImageType::GetImageAllType('author'); foreach ($category_types as $image_type) { foreach ($get_cate_image as $cat_img) { $dir = _PS_MODULE_DIR_ . 'smartblog/images/category/' . $cat_img['id_smart_blog_category'] . '-' . stripslashes($image_type['type_name']) . '.jpg'; if (file_exists($dir)) { unlink($dir); } } } foreach ($posts_types as $image_type) { foreach ($get_blog_image as $blog_img) { $dir = _PS_MODULE_DIR_ . 'smartblog/images/' . $blog_img['id_smart_blog_post'] . '-' . stripslashes($image_type['type_name']) . '.jpg'; if (file_exists($dir)) { unlink($dir); } } } foreach ($author_types as $image_type) { $dir = _PS_MODULE_DIR_ . 'smartblog/images/avatar/avatar-' . stripslashes($image_type['type_name']) . '.jpg'; if (file_exists($dir)) { unlink($dir); } } }