本文整理汇总了PHP中nggAdmin::recover_image方法的典型用法代码示例。如果您正苦于以下问题:PHP nggAdmin::recover_image方法的具体用法?PHP nggAdmin::recover_image怎么用?PHP nggAdmin::recover_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggAdmin
的用法示例。
在下文中一共展示了nggAdmin::recover_image方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ngg_ajax_operation
/**
* Image edit functions via AJAX
*
* @author Alex Rabe
* @copyright 2008 - 2010
*
* @return void
*/
function ngg_ajax_operation()
{
global $wpdb;
// if nonce is not correct it returns -1
check_ajax_referer("ngg-ajax");
// check for correct capability
if (!is_user_logged_in()) {
die('-1');
}
// check for correct NextGEN capability
if (!current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery')) {
die('-1');
}
// include the ngg function
include_once dirname(__FILE__) . '/functions.php';
// Get the image id
if (isset($_POST['image'])) {
$id = (int) $_POST['image'];
// let's get the image data
$picture = nggdb::find_image($id);
// what do you want to do ?
switch ($_POST['operation']) {
case 'create_thumbnail':
$result = nggAdmin::create_thumbnail($picture);
break;
case 'resize_image':
$result = nggAdmin::resize_image($picture);
break;
case 'rotate_cw':
$result = nggAdmin::rotate_image($picture, 'CW');
nggAdmin::create_thumbnail($picture);
break;
case 'rotate_ccw':
$result = nggAdmin::rotate_image($picture, 'CCW');
nggAdmin::create_thumbnail($picture);
break;
case 'set_watermark':
$result = nggAdmin::set_watermark($picture);
break;
case 'recover_image':
$result = nggAdmin::recover_image($picture);
break;
case 'import_metadata':
$result = nggAdmin::import_MetaData($id);
break;
case 'get_image_ids':
$result = nggAdmin::get_image_ids($id);
break;
default:
do_action('ngg_ajax_' . $_POST['operation']);
die('-1');
break;
}
// A success should return a '1'
die($result);
}
// The script should never stop here
die('0');
}
示例2: processor
function processor()
{
global $wpdb, $ngg, $nggdb;
// Delete a picture
if ($this->mode == 'delpic') {
//TODO:Remove also Tag reference
check_admin_referer('ngg_delpicture');
$image = $nggdb->find_image($this->pid);
if ($image) {
if ($ngg->options['deleteImg']) {
@unlink($image->imagePath);
@unlink($image->thumbPath);
@unlink($image->imagePath . '_backup');
}
do_action('ngg_delete_picture', $this->pid);
$result = nggdb::delete_image($this->pid);
}
if ($result) {
nggGallery::show_message(__('Picture', 'nggallery') . ' \'' . $this->pid . '\' ' . __('deleted successfully', 'nggallery'));
}
$this->mode = 'edit';
// show pictures
}
// Recover picture from backup
if ($this->mode == 'recoverpic') {
check_admin_referer('ngg_recoverpicture');
$image = $nggdb->find_image($this->pid);
// bring back the old image
nggAdmin::recover_image($image);
nggAdmin::create_thumbnail($image);
nggGallery::show_message(__('Operation successful. Please clear your browser cache.', "nggallery"));
$this->mode = 'edit';
// show pictures
}
// will be called after a ajax operation
if (isset($_POST['ajax_callback'])) {
if ($_POST['ajax_callback'] == 1) {
nggGallery::show_message(__('Operation successful. Please clear your browser cache.', "nggallery"));
}
}
// show sort order
if (isset($_POST['sortGallery'])) {
$this->mode = 'sort';
}
if (isset($_GET['s'])) {
$this->search_images();
}
}
示例3: processor
function processor()
{
global $wpdb, $ngg, $nggdb;
// Delete a picture
if ($this->mode == 'delpic') {
//TODO:Remove also Tag reference
check_admin_referer('ngg_delpicture');
$image = $nggdb->find_image($this->pid);
if ($image) {
if ($ngg->options['deleteImg']) {
$storage = C_Component_Registry::get_instance()->get_utility('I_Gallery_Storage');
$storage->delete_image($this->pid);
}
$mapper = C_Image_Mapper::get_instance();
$result = $mapper->destroy($this->pid);
do_action('ngg_delete_picture', $this->pid);
if ($result) {
nggGallery::show_message(__('Picture', 'nggallery') . ' \'' . $this->pid . '\' ' . __('deleted successfully', 'nggallery'));
}
}
$this->mode = 'edit';
// show pictures
}
// Recover picture from backup
if ($this->mode == 'recoverpic') {
check_admin_referer('ngg_recoverpicture');
$image = $nggdb->find_image($this->pid);
// bring back the old image
nggAdmin::recover_image($image);
nggAdmin::create_thumbnail($image);
nggGallery::show_message(__('Operation successful. Please clear your browser cache.', "nggallery"));
$this->mode = 'edit';
// show pictures
}
// will be called after a ajax operation
if (isset($_POST['ajax_callback'])) {
if ($_POST['ajax_callback'] == 1) {
nggGallery::show_message(__('Operation successful. Please clear your browser cache.', "nggallery"));
}
}
// show sort order
if (isset($_POST['sortGallery'])) {
$this->mode = 'sort';
}
if (isset($_GET['s'])) {
$this->search_images();
}
}