本文整理匯總了PHP中Images::deleteImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::deleteImage方法的具體用法?PHP Images::deleteImage怎麽用?PHP Images::deleteImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Images
的用法示例。
在下文中一共展示了Images::deleteImage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: header
//Check if user is logged in and trying to delete their own image
require_once './includes/session_timeout.php';
require_once './includes/dbcon.php';
if (!isset($_SESSION['username'])) {
header("Location: login.php");
die;
}
if (!isset($_GET["id"])) {
header("Location: index.php");
die;
}
$id = $_GET["id"];
$userID = $_SESSION['userID'];
require_once './includes/Images/Images.php';
$dbImages = new Images($conn);
$image = $dbImages->getImage($id);
if ($image[5] != $userID) {
header("Location: userpage.php");
die;
}
//Safe to delete
unlink("./img/thumbs/thumb_{$image[2]}");
unlink("./img/large/{$image[2]}");
$result = $dbImages->deleteImage($id);
if ($result) {
header("Location: userpage.php");
die;
} else {
echo "Eitthvað bilaði. <a href='userpage.php'>Til baka?</a>";
}
示例2: Images
$images = new Images();
$response = setResponse($response, $api_response_code, 1);
switch ($_SERVER['REQUEST_METHOD']) {
case 'POST':
$response['data'] = $images->postImage($_POST);
$success = true;
break;
case 'PUT':
if (!empty($action)) {
$response['data'] = $images->setActive($action);
$success = true;
}
break;
case 'DELETE':
if (!empty($action)) {
$response['data'] = $images->deleteImage($action);
$success = true;
}
break;
case 'GET':
if ($action == "search") {
$response['data'] = $images->getImage($_GET['user']);
$success = true;
}
if ($action == null) {
$response['data'] = $images->getImages();
$success = true;
}
break;
default:
break;