本文整理匯總了PHP中ImageManager::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageManager::delete方法的具體用法?PHP ImageManager::delete怎麽用?PHP ImageManager::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageManager
的用法示例。
在下文中一共展示了ImageManager::delete方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: htmlentities
} else {
if ($action == "update") {
$idImage = htmlentities($_POST['idImage']);
if (!empty($_POST['name'])) {
$name = htmlentities($_POST['name']);
$url = htmlentities($_POST['url']);
$description = htmlentities($_POST['description']);
$idProjet = htmlentities($_POST['idProjet']);
$updatedBy = $_SESSION['userAnnahdaSite']->login();
$updated = date('Y-m-d h:i:s');
$image = new Image(array('id' => $idImage, 'name' => $name, 'url' => $url, 'description' => $description, 'idProjet' => $idProjet, 'updated' => $updated, 'updatedBy' => $updatedBy));
$imageManager->update($image);
$actionMessage = "<strong>Opération Valide</strong> : Image Modifié(e) avec succès.";
$typeMessage = "success";
} else {
$actionMessage = "<strong>Erreur Modification Image</strong> : Vous devez remplir le champ 'name'.";
$typeMessage = "danger";
}
} else {
if ($action == "delete") {
$idImage = htmlentities($_POST['idImage']);
$imageManager->delete($idImage);
$actionMessage = "<strong>Opération Valide</strong> : Image supprimé(e) avec succès.";
$typeMessage = "success";
}
}
}
//Action Delete Processing End
$_SESSION['image-action-message'] = $actionMessage;
$_SESSION['image-type-message'] = $typeMessage;
header('Location:../projet-detail.php?idProjet=' . $idProjet . '#images');
示例2: deleteImage
public function deleteImage()
{
$result = array('success' => false, 'message' => 'Delete error.', 'status' => 'error', 'total' => 0, 'records' => array());
$imageId = $this->f3->get('PARAMS.id');
$imageRecords = new ImageManager($this->db);
$image = $imageRecords->getById($imageId);
if (is_file($image[0]->imageLink)) {
$success = unlink($image[0]->imageLink);
if ($success) {
$imageRecords->delete($imageId);
$result[success] = true;
$result[message] = 'Deleted Successfully';
$result[status] = 'success';
}
}
header('Content-Type: application/json');
echo json_encode($result, JSON_NUMERIC_CHECK);
exit;
}