{"action":"opened","issue":{"url":"https://api.github.com/repos/smartdatasoft/smartblog/issues/26","labels_url":"https://api.github.com/repos/smartdatasoft/smartblog/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/smartdatasoft/smartblog/issues/26/comments","events_url":"https://api.github.com/repos/smartdatasoft/smartblog/issues/26/events","html_url":"https://github.com/smartdatasoft/smartblog/issues/26","id":116105968,"number":26,"title":"Fails to delete all thumbs","user":{"login":"megamurmulis","id":979712,"avatar_url":"https://avatars.githubusercontent.com/u/979712?v=3","gravatar_id":"","url":"https://api.github.com/users/megamurmulis","html_url":"https://github.com/megamurmulis","followers_url":"https://api.github.com/users/megamurmulis/followers","following_url":"https://api.github.com/users/megamurmulis/following{/other_user}","gists_url":"https://api.github.com/users/megamurmulis/gists{/gist_id}","starred_url":"https://api.github.com/users/megamurmulis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/megamurmulis/subscriptions","organizations_url":"https://api.github.com/users/megamurmulis/orgs","repos_url":"https://api.github.com/users/megamurmulis/repos","events_url":"https://api.github.com/users/megamurmulis/events{/privacy}","received_events_url":"https://api.github.com/users/megamurmulis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-10T13:28:06Z","updated_at":"2015-11-10T13:28:06Z","closed_at":null,"body":"### Issue - Fails to delete all thumb images + post thumb not updated in backend.\r\n<b>FILE:</b>  smartblog/controllers/admin/AdminBlogPostController.php\r\n```\r\npublic function deleteImage($id_smart_blog_post = 1) {\r\n    ...\r\n        if (file_exists(_MODULE_SMARTBLOG_DIR_ . '/' . $id_smart_blog_post . '.jpg'))\r\n            unlink($this->image_dir . '/' . $id_smart_blog_post . '.jpg');\r\n        else\r\n            return false;\r\n```\r\n<b>1.</b> Should not return on missing img:\r\n```\r\npublic function deleteImage($id_smart_blog_post = 1) {\r\n    ...\r\n        if (file_exists(_MODULE_SMARTBLOG_DIR_ . '/' . $id_smart_blog_post . '.jpg'))\r\n:            @unlink($this->image_dir . '/' . $id_smart_blog_post . '.jpg');\r\n```\r\n<b>2.</b> Also add per language thumbs to delete list + don't bail out for just 1 missing:\r\n```\r\n+        foreach (Language::getLanguages(false) as $lang) {\r\n+\t\t\t$files_to_delete[] = _PS_TMP_IMG_DIR_ . 'smart_blog_post_mini_' . $id_smart_blog_post .'_'. (int)$lang['id_lang'] .'.jpg';\r\n+\t\t}\r\n\t\t\r\n\t\tforeach ($files_to_delete as $file) {\r\n:\t\t\tif (file_exists($file))\r\n:\t\t\t    @unlink($file);\r\n\t\t}\r\n```\r\n"}}