public function ajaxProcessDeleteGallaryImage() { $this->display = 'content'; $res = true; if (!($id_smart_blog_gallary_images = (int) Tools::getValue('id_smart_blog_gallary_images'))) { $this->jsonError(Tools::displayError('An error occurred (the image not exists).')); } /* Delete product image */ $image = new SmartBlogGallaryImage($id_smart_blog_gallary_images); $this->content['id'] = $image->id; //print_r($image); $res &= $image->delete(); if (file_exists(_PS_TMP_IMG_DIR_ . 'smart_blog_post_' . $image->id_smart_blog_gallary_images . '.jpg')) { $res &= @unlink(_PS_TMP_IMG_DIR_ . 'smart_blog_post_' . $image->id_smart_blog_gallary_images . '.jpg'); } if (file_exists(_PS_TMP_IMG_DIR_ . 'smart_blog_post_mini_' . $image->id_smart_blog_gallary_images . '_' . $this->context->shop->id . '.jpg')) { $res &= @unlink(_PS_TMP_IMG_DIR_ . 'smart_blog_post_mini_' . $image->id_smart_blog_gallary_images . '_' . $this->context->shop->id . '.jpg'); } //{"status" : "ok","confirmations" : ["The image was successfully deleted."],"informations" : [],"error" : [],"warnings" : [],"content" : {"id":62}} if ($res) { die(Tools::jsonEncode(array('status' => "ok", "confirmations" => "The image was successfully deleted.", "informations" => "", "error" => "", "warnings" => "", "content" => array('id' => $id_smart_blog_gallary_images)))); } else { $this->jsonError(Tools::displayError('An error occurred while attempting to delete the product image.')); } }