当前位置: 首页>>代码示例>>PHP>>正文


PHP nggdb::find_image方法代码示例

本文整理汇总了PHP中nggdb::find_image方法的典型用法代码示例。如果您正苦于以下问题:PHP nggdb::find_image方法的具体用法?PHP nggdb::find_image怎么用?PHP nggdb::find_image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nggdb的用法示例。


在下文中一共展示了nggdb::find_image方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createNewThumb

function createNewThumb()
{
    global $ngg;
    // check for correct capability
    if (!is_user_logged_in()) {
        die('-1');
    }
    // check for correct NextGEN capability
    if (!current_user_can('NextGEN Manage gallery')) {
        die('-1');
    }
    $id = (int) $_POST['id'];
    $picture = nggdb::find_image($id);
    $x = round($_POST['x'] * $_POST['rr'], 0);
    $y = round($_POST['y'] * $_POST['rr'], 0);
    $w = round($_POST['w'] * $_POST['rr'], 0);
    $h = round($_POST['h'] * $_POST['rr'], 0);
    $crop_frame = array('x' => $x, 'y' => $y, 'width' => $w, 'height' => $h);
    $registry = C_Component_Registry::get_instance();
    $storage = C_Gallery_Storage::get_instance();
    // XXX NextGEN Legacy wasn't handling watermarks or reflections at this stage, so we're forcefully disabling them to maintain compatibility
    $params = array('watermark' => false, 'reflection' => false, 'crop' => true, 'crop_frame' => $crop_frame);
    $result = $storage->generate_thumbnail($id, $params);
    if ($result) {
        echo "OK";
    } else {
        header('HTTP/1.1 500 Internal Server Error');
        echo "KO";
    }
    C_NextGEN_Bootstrap::shutdown();
}
开发者ID:albinmartinsson91,项目名称:ux_blog,代码行数:31,代码来源:ajax.php

示例2: nggMeta

 /**
  * nggMeta::nggMeta()
  * 
  * @param int $image path to a image
  * @param bool $onlyEXIF parse only exif if needed
  * @return
  */
 function nggMeta($pic_id, $onlyEXIF = false)
 {
     //get the path and other data about the image
     $this->image = nggdb::find_image($pic_id);
     $this->image = apply_filters('ngg_find_image_meta', $this->image);
     if (!file_exists($this->image->imagePath)) {
         return false;
     }
     $this->size = @getimagesize($this->image->imagePath, $metadata);
     if ($this->size && is_array($metadata)) {
         // get exif - data
         if (is_callable('exif_read_data')) {
             $this->exif_data = @exif_read_data($this->image->imagePath, 0, true);
         }
         // stop here if we didn't need other meta data
         if ($onlyEXIF) {
             return true;
         }
         // get the iptc data - should be in APP13
         if (is_callable('iptcparse') && isset($metadata['APP13'])) {
             $this->iptc_data = @iptcparse($metadata['APP13']);
         }
         // get the xmp data in a XML format
         if (is_callable('xml_parser_create')) {
             $this->xmp_data = $this->extract_XMP($this->image->imagePath);
         }
         return true;
     }
     return false;
 }
开发者ID:Ashleyotero,项目名称:oldest-old,代码行数:37,代码来源:meta.php

示例3: ngg_ajax_operation

/**
 * Image edit functions via AJAX
 *
 * @author Alex Rabe
 *
 *
 * @return void
 */
function ngg_ajax_operation()
{
    // 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($id) ? '1' : '0';
                break;
            case 'import_metadata':
                $result = C_Image_Mapper::get_instance()->reimport_metadata($id) ? '1' : '0';
                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');
}
开发者ID:kixortillan,项目名称:dfosashworks,代码行数:66,代码来源:ajax.php

示例4: createNewThumb

function createNewThumb()
{
    global $ngg;
    // check for correct capability
    if (!is_user_logged_in()) {
        die('-1');
    }
    // check for correct NextGEN capability
    if (!current_user_can('NextGEN Manage gallery')) {
        die('-1');
    }
    include_once nggGallery::graphic_library();
    $id = (int) $_POST['id'];
    $picture = nggdb::find_image($id);
    $x = round($_POST['x'] * $_POST['rr'], 0);
    $y = round($_POST['y'] * $_POST['rr'], 0);
    $w = round($_POST['w'] * $_POST['rr'], 0);
    $h = round($_POST['h'] * $_POST['rr'], 0);
    $thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
    $thumb->crop($x, $y, $w, $h);
    // Note : the routine is a bit different to create_thumbnail(), due to rounding it's resized in the other way
    if ($ngg->options['thumbfix']) {
        // check for portrait format
        if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
            // first resize to the wanted height, here changed to create_thumbnail()
            $thumb->resize(0, $ngg->options['thumbheight']);
            // get optimal y startpos
            $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
            $thumb->crop(0, $ypos, $ngg->options['thumbwidth'], $ngg->options['thumbheight']);
        } else {
            // first resize to the wanted width, here changed to create_thumbnail()
            $thumb->resize($ngg->options['thumbwidth'], 0);
            //
            // get optimal x startpos
            $xpos = ($thumb->currentDimensions['width'] - $ngg->options['thumbwidth']) / 2;
            $thumb->crop($xpos, 0, $ngg->options['thumbwidth'], $ngg->options['thumbheight']);
        }
        //this create a thumbnail but keep ratio settings
    } else {
        $thumb->resize($ngg->options['thumbwidth'], $ngg->options['thumbheight']);
    }
    if ($thumb->save($picture->thumbPath, 100)) {
        //read the new sizes
        $new_size = @getimagesize($picture->thumbPath);
        $size['width'] = $new_size[0];
        $size['height'] = $new_size[1];
        // add them to the database
        nggdb::update_image_meta($picture->pid, array('thumbnail' => $size));
        echo "OK";
    } else {
        header('HTTP/1.1 500 Internal Server Error');
        echo "KO";
    }
    exit;
}
开发者ID:jhersonn20,项目名称:myportal,代码行数:55,代码来源:ajax.php

示例5: createNewThumb

function createNewThumb()
{
    // check for correct capability
    if (!is_user_logged_in()) {
        die('-1');
    }
    // check for correct NextGEN capability
    if (!current_user_can('NextGEN Manage gallery')) {
        die('-1');
    }
    require_once dirname(dirname(__FILE__)) . '/ngg-config.php';
    include_once nggGallery::graphic_library();
    $ngg_options = get_option('ngg_options');
    $id = (int) $_POST['id'];
    $picture = nggdb::find_image($id);
    $x = round($_POST['x'] * $_POST['rr'], 0);
    $y = round($_POST['y'] * $_POST['rr'], 0);
    $w = round($_POST['w'] * $_POST['rr'], 0);
    $h = round($_POST['h'] * $_POST['rr'], 0);
    $thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
    $thumb->crop($x, $y, $w, $h);
    if ($ngg_options['thumbfix']) {
        if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
            $thumb->resize($ngg_options['thumbwidth'], 0);
        } else {
            $thumb->resize(0, $ngg_options['thumbheight']);
        }
    } else {
        $thumb->resize($ngg_options['thumbwidth'], $ngg_options['thumbheight'], $ngg_options['thumbResampleMode']);
    }
    if ($thumb->save($picture->thumbPath, 100)) {
        //read the new sizes
        $new_size = @getimagesize($picture->thumbPath);
        $size['width'] = $new_size[0];
        $size['height'] = $new_size[1];
        // add them to the database
        nggdb::update_image_meta($picture->pid, array('thumbnail' => $size));
        echo "OK";
    } else {
        header('HTTP/1.1 500 Internal Server Error');
        echo "KO";
    }
    exit;
}
开发者ID:alx,项目名称:SimplePress,代码行数:44,代码来源:ajax.php

示例6: ngg_ajax_operation

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 'set_watermark':
                $result = nggAdmin::set_watermark($picture);
                break;
            default:
                die('-1');
                break;
        }
        // A success should retun a '1'
        die($result);
    }
    // The script should never stop here
    die('0');
}
开发者ID:pravinhirmukhe,项目名称:flow1,代码行数:41,代码来源:ajax.php

示例7: output


//.........这里部分代码省略.........
" />
	<table width="100%" border="0" cellspacing="3" cellpadding="3" >
	  	<tr>
	    	<th>
	    		<?php 
            esc_html_e('Album name:', 'nggallery');
            ?>
<br />
				<input class="search-input" id="album_name" name="album_name" type="text" value="<?php 
            echo esc_attr($album->name);
            ?>
" style="width:95%" />
	    	</th>
	  	</tr>
	  	<tr>
	    	<th>
	    		<?php 
            esc_html_e('Album description:', 'nggallery');
            ?>
<br />
	    		<textarea class="search-input" id="album_desc" name="album_desc" cols="50" rows="2" style="width:95%" ><?php 
            echo esc_attr($album->albumdesc);
            ?>
</textarea>
	    	</th>
	  	</tr>
	  	<tr>
	    	<th>
	    		<?php 
            esc_html_e('Select a preview image:', 'nggallery');
            ?>
<br />
					<select id="previewpic" name="previewpic" style="width:95%" >
                        <?php 
            if ($album->previewpic == 0) {
            }
            ?>
		                <option value="0"><?php 
            esc_html_e('No picture', 'nggallery');
            ?>
</option>
						<?php 
            if ($album->previewpic == 0) {
                echo '<option value="0" selected="selected">' . __('No picture', 'nggallery') . '</option>';
            } else {
                $picture = nggdb::find_image($album->previewpic);
                echo '<option value="' . $picture->pid . '" selected="selected" >' . $picture->pid . ' - ' . (empty($picture->alltext) ? esc_attr($picture->filename) : esc_attr($picture->alltext)) . ' </option>' . "\n";
            }
            ?>
					</select>
	    	</th>
	  	</tr>
        <tr>
            <th>
                <?php 
            esc_html_e('Page Link to', 'nggallery');
            ?>
<br />
                    <select name="pageid" style="width:95%">
                        <option value="0" ><?php 
            esc_html_e('Not linked', 'nggallery');
            ?>
</option>
                        <?php 
            if (!isset($album->pageid)) {
                $album->pageid = 0;
            }
            parent_dropdown($album->pageid);
            ?>
                    </select>
            </th>
        </tr>
        
        <?php 
            do_action('ngg_edit_album_settings', $this->currentID);
            ?>
        
	  	<tr align="right">
	    	<td class="submit">
	    		<input type="submit" class="button-primary" name="update_album" value="<?php 
            esc_attr_e('OK', 'nggallery');
            ?>
" />
	    		&nbsp;
	    		<input class="button-secondary dialog-cancel" type="reset" value="<?php 
            esc_attr_e('Cancel', 'nggallery');
            ?>
"/>
	    	</td>
		</tr>
	</table>
	</form>
</div>
<!-- /#editalbum -->
<?php 
        }
        ?>

<?php 
    }
开发者ID:Ashleyotero,项目名称:oldest-old,代码行数:101,代码来源:album.php

示例8: get_image_path

 function get_image_path()
 {
     global $post;
     $id = get_post_thumbnail_id();
     // check to see if NextGen Gallery is present
     if (stripos($id, 'ngg-') !== false && class_exists('nggdb')) {
         $nggImage = nggdb::find_image(str_replace('ngg-', '', $id));
         $thumbnail = array($nggImage->imageURL, $nggImage->width, $nggImage->height);
         // otherwise, just get the wp thumbnail
     } else {
         $thumbnail = wp_get_attachment_image_src($id, 'full', true);
     }
     $theimage = $thumbnail[0];
     return $theimage;
 }
开发者ID:nackynoona,项目名称:skeleton_wp,代码行数:15,代码来源:functions.php

示例9: dirname

 NextGen Gallery : Alex Rabe | http://alexrabe.boelinger.com/wordpress-plugins/nextgen-gallery/
 jCrop : Kelly Hallman <khallman@wrack.org> | http://deepliquid.com/content/Jcrop.html
 
**/
require_once dirname(dirname(__FILE__)) . '/ngg-config.php';
require_once NGGALLERY_ABSPATH . '/lib/image.php';
if (!is_user_logged_in()) {
    die(__('Cheatin&#8217; uh?'));
}
if (!current_user_can('NextGEN Manage gallery')) {
    die(__('Cheatin&#8217; uh?'));
}
global $wpdb;
$id = (int) $_GET['id'];
// let's get the image data
$picture = nggdb::find_image($id);
include_once nggGallery::graphic_library();
$ngg_options = get_option('ngg_options');
$thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
$thumb->resize(350, 350);
// we need the new dimension
$resizedPreviewInfo = $thumb->newDimensions;
$thumb->destruct();
$preview_image = NGGALLERY_URLPATH . 'nggshow.php?pid=' . $picture->pid . '&amp;width=350&amp;height=350';
$imageInfo = @getimagesize($picture->imagePath);
$rr = round($imageInfo[0] / $resizedPreviewInfo['newWidth'], 2);
if ($ngg_options['thumbfix'] == 1) {
    $WidthHtmlPrev = $ngg_options['thumbwidth'];
    $HeightHtmlPrev = $ngg_options['thumbheight'];
} else {
    // H > W
开发者ID:ahsaeldin,项目名称:projects,代码行数:31,代码来源:edit-thumbnail.php

示例10: handleUpload_widget

 public function handleUpload_widget()
 {
     global $wpdb;
     require_once dirname(__FILE__) . '/class.npu_uploader.php';
     require_once NGGALLERY_ABSPATH . '/lib/meta.php';
     $ngg->options['swfupload'] = false;
     //Where is this being instantiated?
     if (isset($_POST['uploadimage_widget'])) {
         check_admin_referer('ngg_addgallery');
         if (!isset($_FILES['MF__F_0_0']['error']) || $_FILES['MF__F_0_0']['error'] == 0) {
             $objUploaderNggAdmin = new UploaderNggAdmin();
             $messagetext = $objUploaderNggAdmin->upload_images_widget();
             $this->arrImageIds = $objUploaderNggAdmin->arrImageIds;
             $this->strGalleryPath = $objUploaderNggAdmin->strGalleryPath;
             $this->arrImageNames = $objUploaderNggAdmin->arrImageNames;
             if (is_array($objUploaderNggAdmin->arrThumbReturn) && count($objUploaderNggAdmin->arrThumbReturn) > 0) {
                 foreach ($objUploaderNggAdmin->arrThumbReturn as $strReturnMsg) {
                     if ($strReturnMsg != '1') {
                         $this->arrErrorMsg_widg[] = $strReturnMsg;
                     }
                 }
                 $this->arrImageMsg_widg[] = get_option('npu_upload_success') ? get_option('npu_upload_success') : __('Thank you! Your image has been submitted and is pending review.', 'nextgen-public-uploader');
                 $this->sendEmail();
             }
             //Used in update_details method.
             if (is_array($this->arrImageIds) && count($this->arrImageIds) > 0) {
                 foreach ($this->arrImageIds as $imageId) {
                     $pic = nggdb::find_image($imageId);
                     $objEXIF = new nggMeta($pic->imagePath);
                     $this->strTitle = $objEXIF->get_META('title');
                     $this->strDescription = $objEXIF->get_META('caption');
                     $this->strKeywords = $objEXIF->get_META('keywords');
                     $this->strTimeStamp = $objEXIF->get_date_time();
                 }
             } else {
                 $this->arrErrorMsg_widg[] = get_option('npu_no_file') ? get_option('npu_no_file') : __('You must select a file to upload', 'nextgen-public-uploader');
             }
             $this->update_details();
         } else {
             $this->arrErrorMsg_widg[] = get_option('npu_upload_failed') ? get_option('npu_upload_failed') : __('Upload failed!', 'nextgen-public-uploader');
         }
         //If we've encountered any errors, delete?
         if (count($this->arrErrorMsg_widg) > 0 && (is_array($this->arrImageIds) && count($this->arrImageIds) > 0)) {
             $gal_id = !empty($_POST['galleryselect']) ? absint($_POST['galleryselect']) : 1;
             foreach ($this->arrImageIds as $intImageId) {
                 $filename = $wpdb->get_var("SELECT filename FROM {$wpdb->nggpictures} WHERE pid = '{$intImageId}' ");
                 if ($filename) {
                     $gallerypath = $wpdb->get_var($wpdb->prepare("SELECT path FROM {$wpdb->nggallery} WHERE gid = %d", $gal_id));
                     if ($gallerypath) {
                         @unlink(WINABSPATH . $gallerypath . '/thumbs/thumbs_' . $filename);
                         @unlink(WINABSPATH . $gallerypath . '/' . $filename);
                     }
                     $delete_pic = $wpdb->delete($wpdb->nggpictures, array('pid' => $intImageId), array('%d'));
                 }
             }
         }
     }
 }
开发者ID:bowens,项目名称:NextGen-Public-Uploader,代码行数:58,代码来源:npu-upload.php

示例11: header

<?php

require_once './wp-content/plugins/nextgen-gallery/ngg-config.php';
require_once './inc/php/cfg.php';
if (!empty($_GET['pid'])) {
    $foto = nggdb::find_image($_GET['pid']);
    if (empty($foto) or $foto->exclude == 1) {
        $fotos = nggdb::get_random_images();
        $foto = $fotos[0];
    }
    $tags = wp_get_object_terms($_GET['pid'], 'ngg_tag');
} else {
    if ($_SESSION['last_pid'] > 0) {
        $pid = mt_rand(1, $_SESSION['last_pid']);
        header("Location: /foto/{$pid}.html");
    } else {
        header('Location: /');
    }
}
$foto_url = str_replace($cfg['trueurl'], $cfg['baseurl'], $foto->imageURL);
//输出页头keywords
if (!empty($tags)) {
    $key_arr = array();
    foreach ($tags as $tag) {
        $key_arr[] = $tag->slug;
        $keywords = implode(',', $key_arr);
    }
} else {
    $keywords = $cfg['keywords'];
}
//输出keywords
开发者ID:pravinhirmukhe,项目名称:flow1,代码行数:31,代码来源:foto.php

示例12: nggCreateImageBrowser

/**
 * nggCreateImageBrowser()
 *
 * @access internal
 * @param array $picturelist
 * @param string $template (optional) name for a template file, look for imagebrowser-$template
 * @return the content
 */
function nggCreateImageBrowser($picturelist, $template = '')
{
    global $nggRewrite, $ngg;
    require_once dirname(__FILE__) . '/lib/meta.php';
    // $_GET from wp_query
    $pid = get_query_var('pid');
    // we need to know the current page id
    $current_page = get_the_ID() == false ? 0 : get_the_ID();
    // create a array with id's for better walk inside
    foreach ($picturelist as $picture) {
        $picarray[] = $picture->pid;
    }
    $total = count($picarray);
    if (!empty($pid)) {
        if (is_numeric($pid)) {
            $act_pid = intval($pid);
        } else {
            // in the case it's a slug we need to search for the pid
            foreach ($picturelist as $key => $picture) {
                if ($picture->image_slug == $pid) {
                    $act_pid = $key;
                    break;
                }
            }
        }
    } else {
        reset($picarray);
        $act_pid = current($picarray);
    }
    // get ids for back/next
    $key = array_search($act_pid, $picarray);
    if (!$key) {
        $act_pid = reset($picarray);
        $key = key($picarray);
    }
    $back_pid = $key >= 1 ? $picarray[$key - 1] : end($picarray);
    $next_pid = $key < $total - 1 ? $picarray[$key + 1] : reset($picarray);
    // get the picture data
    $picture = nggdb::find_image($act_pid);
    // if we didn't get some data, exit now
    if ($picture == null) {
        return;
    }
    // add more variables for render output
    $picture->href_link = $picture->get_href_link();
    $args['pid'] = $ngg->options['usePermalinks'] ? $picturelist[$back_pid]->image_slug : $back_pid;
    $picture->previous_image_link = $nggRewrite->get_permalink($args);
    $picture->previous_pid = $back_pid;
    $args['pid'] = $ngg->options['usePermalinks'] ? $picturelist[$next_pid]->image_slug : $next_pid;
    $picture->next_image_link = $nggRewrite->get_permalink($args);
    $picture->next_pid = $next_pid;
    $picture->number = $key + 1;
    $picture->total = $total;
    $picture->linktitle = empty($picture->description) ? ' ' : htmlspecialchars(stripslashes(nggGallery::i18n($picture->description, 'pic_' . $picture->pid . '_description')));
    $picture->alttext = empty($picture->alttext) ? ' ' : html_entity_decode(stripslashes(nggGallery::i18n($picture->alttext, 'pic_' . $picture->pid . '_alttext')));
    $picture->description = empty($picture->description) ? ' ' : html_entity_decode(stripslashes(nggGallery::i18n($picture->description, 'pic_' . $picture->pid . '_description')));
    $picture->anchor = 'ngg-imagebrowser-' . $picture->galleryid . '-' . $current_page;
    // filter to add custom content for the output
    $picture = apply_filters('ngg_image_object', $picture, $act_pid);
    // let's get the meta data
    $meta = new nggMeta($act_pid);
    $meta->sanitize();
    $exif = $meta->get_EXIF();
    $iptc = $meta->get_IPTC();
    $xmp = $meta->get_XMP();
    $db = $meta->get_saved_meta();
    //if we get no exif information we try the database
    $exif = $exif == false ? $db : $exif;
    // look for imagebrowser-$template.php or pure imagebrowser.php
    $filename = empty($template) ? 'imagebrowser' : 'imagebrowser-' . $template;
    // create the output
    $out = nggGallery::capture($filename, array('image' => $picture, 'meta' => $meta, 'exif' => $exif, 'iptc' => $iptc, 'xmp' => $xmp, 'db' => $db));
    return $out;
}
开发者ID:hiaedenis,项目名称:nextgen-gallery,代码行数:82,代码来源:nggfunctions.php

示例13: editImage

 /**
  * Method "ngg.editImage"
  * Edit a existing Image
  * 
  * @since 1.7.3
  * 
  * @param array $args Method parameters.
  * 			- int blog_id
  *	    	- string username
  *	    	- string password
  *	    	- int Image ID
  *	    	- string alt/title text
  *	    	- string description
  *	    	- int exclude from gallery (0 or 1)
  * @return true if success
  */
 function editImage($args)
 {
     global $ngg;
     require_once dirname(dirname(__FILE__)) . '/admin/functions.php';
     // admin functions
     $this->escape($args);
     $blog_ID = (int) $args[0];
     $username = $args[1];
     $password = $args[2];
     $id = (int) $args[3];
     $alttext = $args[4];
     $description = $args[5];
     $exclude = (int) $args[6];
     if (!($user = $this->login($username, $password))) {
         return $this->error;
     }
     if (!($image = nggdb::find_image($id))) {
         return new IXR_Error(404, __("Invalid image ID"));
     }
     if (!current_user_can('NextGEN Manage gallery') && !nggAdmin::can_manage_this_gallery($image->author)) {
         return new IXR_Error(401, __('Sorry, you must be able to edit this image'));
     }
     if (!empty($alttext)) {
         $result = nggdb::update_image($id, false, false, $description, $alttext, $exclude);
     }
     if (!$result) {
         return new IXR_Error(500, __('Sorry, could not update the image'));
     }
     return true;
 }
开发者ID:rtgibbons,项目名称:bya.org,代码行数:46,代码来源:xmlrpc.php

示例14: import_MetaData

 /**
  * Import some meta data into the database (if avialable)
  * 
  * @class nggAdmin
  * @param array|int $imagesIds
  * @return string result code
  */
 function import_MetaData($imagesIds)
 {
     global $wpdb;
     require_once NGGALLERY_ABSPATH . '/lib/image.php';
     if (!is_array($imagesIds)) {
         $imagesIds = array($imagesIds);
     }
     foreach ($imagesIds as $imageID) {
         $image = nggdb::find_image($imageID);
         if (!$image->error) {
             $meta = nggAdmin::get_MetaData($image->pid);
             // get the title
             $alttext = empty($meta['title']) ? $image->alttext : $meta['title'];
             // get the caption / description field
             $description = empty($meta['caption']) ? $image->description : $meta['caption'];
             // get the file date/time from exif
             $timestamp = $meta['timestamp'];
             // first update database
             $result = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggpictures} SET \r\n\t\t\t\t\t\talttext = %s, \r\n\t\t\t\t\t\tdescription = %s, \r\n\t\t\t\t\t\timagedate = %s\r\n\t\t\t\t\tWHERE pid = %d", $alttext, $description, $timestamp, $image->pid));
             if ($result === false) {
                 return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'nggallery') . '</strong>';
             }
             //this flag will inform us that the import is already one time performed
             $meta['common']['saved'] = true;
             $result = nggdb::update_image_meta($image->pid, $meta['common']);
             if ($result === false) {
                 return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update meta data)', 'nggallery') . '</strong>';
             }
             // add the tags if we found some
             if ($meta['keywords']) {
                 $taglist = explode(',', $meta['keywords']);
                 wp_set_object_terms($image->pid, $taglist, 'ngg_tag');
             }
         } else {
             return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not find image)', 'nggallery') . '</strong>';
         }
         // error check
     }
     return '1';
 }
开发者ID:ahsaeldin,项目名称:projects,代码行数:47,代码来源:functions.php

示例15: media_upload_nextgen_form


//.........这里部分代码省略.........
    ?>
" class="button-secondary" />
	</div>
	<br style="clear:both;" />
</div>
</form>

<form enctype="multipart/form-data" method="post" action="<?php 
    echo esc_attr($form_action_url);
    ?>
" class="media-upload-form" id="library-form">

	<?php 
    wp_nonce_field('ngg-media-form');
    ?>

	<script type="text/javascript">
	<!--
	jQuery(function($){
		var preloaded = $(".media-item.preloaded");
		if ( preloaded.length > 0 ) {
			preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
			updateMediaForm();
		}
	});
	-->
	</script>
	
	<div id="media-items">
	<?php 
    if (is_array($picarray)) {
        foreach ($picarray as $picid) {
            //TODO:Reduce SQL Queries
            $picture = nggdb::find_image($picid);
            ?>
			<div id='media-item-<?php 
            echo $picid;
            ?>
' class='media-item preloaded'>
			  <div class='filename'></div>
			  <a class='toggle describe-toggle-on' href='#'><?php 
            esc_attr(_e('Show', "nggallery"));
            ?>
</a>
			  <a class='toggle describe-toggle-off' href='#'><?php 
            esc_attr(_e('Hide', "nggallery"));
            ?>
</a>
			  <div class='filename new'><?php 
            echo empty($picture->alttext) ? wp_html_excerpt($picture->filename, 60) : stripslashes(wp_html_excerpt($picture->alttext, 60));
            ?>
</div>
			  <table class='slidetoggle describe startclosed'><tbody>
				  <tr>
					<td rowspan='4'><img class='thumbnail' alt='<?php 
            echo esc_attr($picture->alttext);
            ?>
' src='<?php 
            echo esc_attr($picture->thumbURL);
            ?>
'/></td>
					<td><?php 
            esc_attr(_e('Image ID:', "nggallery"));
            echo $picid;
            ?>
</td>
开发者ID:ahsaeldin,项目名称:projects,代码行数:67,代码来源:media-upload.php


注:本文中的nggdb::find_image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。