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


PHP nggdb类代码示例

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


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

示例1: validation

 /**
  * Validates whether the gallery can be saved
  */
 function validation()
 {
     // If a title is present, we can auto-populate some other properties
     if (isset($this->object->title)) {
         // If no name is present, use the title to generate one
         if (!isset($this->object->name)) {
             $this->object->name = sanitize_file_name(sanitize_title($this->object->title));
             $this->object->name = apply_filters('ngg_gallery_name', $this->object->name);
         }
         // If no slug is set, use the title to generate one
         if (!isset($this->object->slug)) {
             $this->object->slug = nggdb::get_unique_slug(sanitize_title($this->object->title), 'gallery');
         }
     }
     // Set what will be the path to the gallery
     if (empty($this->object->path)) {
         $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
         $this->object->path = $storage->get_upload_relpath($this->object);
         unset($storage);
     }
     $this->object->validates_presence_of('title');
     $this->object->validates_presence_of('name');
     $this->object->validates_uniqueness_of('slug');
     $this->object->validates_numericality_of('author');
     return $this->object->is_valid();
 }
开发者ID:namwoody,项目名称:curry,代码行数:29,代码来源:class.gallery.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: slideshow

    public function slideshow($galleryID, $type)
    {
        if (!$galleryID) {
            return "";
        }
        $fade = $type == "widget" ? 'data-fade="enabled"' : "";
        $picturelist = nggdb::get_gallery($galleryID, $this->options['galSort'], $this->options['galSortDir']);
        $html = '<div class="sliderWrap"><div class="slider" data-delay="3" data-pause="enabled" ' . $fade . '>';
        $blank = PE_THEME_URL . "/img/blank.png";
        $first = true;
        foreach ($picturelist as $p) {
            if ($first) {
                $src = $p->thumbURL;
                $data = "";
                $first = false;
            } else {
                $src = $blank;
                $data = $p->thumbURL;
            }
            $html .= <<<EOL
<a data-target="prettyphoto" href="{$p->imageURL}" title="{$p->title}"><img src="{$src}" data-src="{$data}" alt="{$p->title}"/></a>
EOL;
        }
        $html .= "</div></div>";
        return $html;
    }
开发者ID:JeffreyBue,项目名称:jb,代码行数:26,代码来源:PeThemeNgg.php

示例4: 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

示例5: set_defaults

 /**
  * Sets the defaults for an album
  * @param C_DataMapper_Model|C_Album|stdClass $entity
  */
 function set_defaults($entity)
 {
     $this->object->_set_default_value($entity, 'name', '');
     $this->object->_set_default_value($entity, 'albumdesc', '');
     $this->object->_set_default_value($entity, 'sortorder', array());
     $this->object->_set_default_value($entity, 'previewpic', 0);
     $this->object->_set_default_value($entity, 'exclude', 0);
     $this->object->_set_default_value($entity, 'slug', nggdb::get_unique_slug(sanitize_title($entity->name), 'album'));
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:13,代码来源:class.album_mapper.php

示例6: ewww_added_new_image

 function ewww_added_new_image($image, $storage = null)
 {
     ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
     global $ewww_defer;
     if (empty($storage)) {
         // creating the 'registry' object for working with nextgen
         $registry = C_Component_Registry::get_instance();
         // creating a database storage object from the 'registry' object
         $storage = $registry->get_utility('I_Gallery_Storage');
     }
     // find the image id
     if (is_array($image)) {
         $image_id = $image['id'];
         $image = $storage->object->_image_mapper->find($image_id, TRUE);
     } else {
         $image_id = $storage->object->_get_image_id($image);
     }
     ewwwio_debug_message("image id: {$image_id}");
     if ($ewww_defer && ewww_image_optimizer_get_option('ewww_image_optimizer_defer')) {
         ewww_image_optimizer_add_deferred_attachment("nextgen2,{$image_id}");
         return;
     }
     // get an array of sizes available for the $image
     $sizes = $storage->get_image_sizes();
     // run the optimizer on the image for each $size
     foreach ($sizes as $size) {
         if ($size === 'full') {
             $full_size = true;
         } else {
             $full_size = false;
         }
         // get the absolute path
         $file_path = $storage->get_image_abspath($image, $size);
         ewwwio_debug_message("optimizing (nextgen): {$file_path}");
         // optimize the image and grab the results
         $res = ewww_image_optimizer($file_path, 2, false, false, $full_size);
         ewwwio_debug_message("results {$res[1]}");
         // only if we're dealing with the full-size original
         if ($size === 'full') {
             // update the metadata for the optimized image
             $image->meta_data['ewww_image_optimizer'] = $res[1];
         } else {
             $image->meta_data[$size]['ewww_image_optimizer'] = $res[1];
         }
         nggdb::update_image_meta($image_id, $image->meta_data);
         ewwwio_debug_message('storing results for full size image');
     }
     return $image;
 }
开发者ID:agiper,项目名称:wordpress,代码行数:49,代码来源:nextgen2-integration.php

示例7: ewww_added_new_image

 function ewww_added_new_image($image, $storage = null)
 {
     global $ewww_debug;
     $ewww_debug .= "<b>ewww_added_new_image()</b><br>";
     if (empty($storage)) {
         // creating the 'registry' object for working with nextgen
         $registry = C_Component_Registry::get_instance();
         // creating a database storage object from the 'registry' object
         $storage = $registry->get_utility('I_Gallery_Storage');
     }
     // find the image id
     $image_id = $storage->object->_get_image_id($image);
     $ewww_debug .= "image id: {$image_id}<br>";
     // get an array of sizes available for the $image
     $sizes = $storage->get_image_sizes();
     // run the optimizer on the image for each $size
     foreach ($sizes as $size) {
         if ($size === 'full') {
             $full_size = true;
         } else {
             $full_size = false;
         }
         // get the absolute path
         $file_path = $storage->get_image_abspath($image, $size);
         $ewww_debug .= "optimizing (nextgen): {$file_path}<br>";
         // optimize the image and grab the results
         $res = ewww_image_optimizer($file_path, 2, false, false, $full_size);
         $ewww_debug .= "results " . $res[1] . "<br>";
         // only if we're dealing with the full-size original
         if ($size === 'full') {
             // update the metadata for the optimized image
             $image->meta_data['ewww_image_optimizer'] = $res[1];
         } else {
             $image->meta_data[$size]['ewww_image_optimizer'] = $res[1];
         }
         nggdb::update_image_meta($image_id, $image->meta_data);
         $ewww_debug .= 'storing results for full size image<br>';
     }
     ewww_image_optimizer_debug_log();
     return $image;
 }
开发者ID:hkarriche,项目名称:wordpress,代码行数:41,代码来源:nextgen2-integration.php

示例8: 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

示例9: add_gallery_gid

    function add_gallery_gid($gid = '', $title = '', $path = '', $description = '',
        $pageid = 0, $previewpic = 0, $author = 0  )
    {
        global $wpdb;
       
        $slug = nggdb::get_unique_slug( sanitize_title( $title ), 'gallery' );
		
		if ( false === $wpdb->query( $wpdb->prepare(
            "INSERT INTO $wpdb->nggallery (
                gid, name, slug, path, title, galdesc, pageid, previewpic, author
            ) VALUES (
                %d, %s, %s, %s, %s, %s, %d, %d, %d)",
            $gid, $slug, $slug, $path, $title, $description, $pageid, $previewpic, $author )))
        {
			return false;
		}
		
		$galleryID = (int) $wpdb->insert_id;
         
		//and give me the new id		
		return $galleryID;
    }
开发者ID:robehickman,项目名称:Scripts,代码行数:22,代码来源:gengal.php

示例10: getNGGalleryImages

function getNGGalleryImages($ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error)
{
    $result = array();
    $galids = explode(',', $ngGalleries);
    $imgids = explode(',', $ngImages);
    if (!isNGGalleryActive()) {
        return '';
    }
    try {
        $pictures = array();
        foreach ($galids as $g) {
            $pictures = array_merge($pictures, nggdb::get_gallery($g));
        }
        foreach ($imgids as $i) {
            array_push($pictures, nggdb::find_image($i));
        }
        foreach ($pictures as $p) {
            $item = array();
            $item["data"] = $p->thumbHTML;
            if (is_callable('exif_read_data')) {
                $exif = @exif_read_data($p->imagePath);
                if ($exif !== false) {
                    $item["lon"] = getExifGps($exif["GPSLongitude"], $exif['GPSLongitudeRef']);
                    $item["lat"] = getExifGps($exif["GPSLatitude"], $exif['GPSLatitudeRef']);
                    if ($item["lat"] != 0 || $item["lon"] != 0) {
                        $result[] = $item;
                    } else {
                        if (isset($p->imagedate)) {
                            $_dt = strtotime($p->imagedate) + $dtoffset;
                            $_item = findItemCoordinate($_dt, $dt, $lat, $lon);
                            if ($_item != null) {
                                $item["lat"] = $_item["lat"];
                                $item["lon"] = $_item["lon"];
                                $result[] = $item;
                            }
                        }
                    }
                }
            } else {
                $error .= "Sorry, <a href='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >exif_read_data</a> function not found! check your hosting..<br />";
            }
        }
        /* START FIX NEXT GEN GALLERY 2.x */
        if (class_exists("C_Component_Registry")) {
            $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
            $params['gallery_ids'] = $ngGalleries;
            $params['image_ids'] = $ngImages;
            $params['display_type'] = NEXTGEN_GALLERY_BASIC_THUMBNAILS;
            $params['images_per_page'] = 999;
            // also add js references to get the gallery working
            $dummy = $renderer->display_images($params, $inner_content);
            /* START FIX NEXT GEN GALLERY PRO */
            if (preg_match("/data-nplmodal-gallery-id=[\"'](.*?)[\"']/", $dummy, $m)) {
                $galid = $m[1];
                if ($galid) {
                    for ($i = 0; $i < count($result); ++$i) {
                        $result[$i]["data"] = str_replace("%PRO_LIGHTBOX_GALLERY_ID%", $galid, $result[$i]["data"]);
                    }
                }
            }
            /* END FIX NEXT GEN GALLERY PRO */
        }
        /* END FIX NEXT GEN GALLERY 2.x */
    } catch (Exception $e) {
        $error .= 'Error When Retrieving NextGen Gallery galleries/images: $e <br />';
    }
    return $result;
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:68,代码来源:wp-gpx-maps_utils_nggallery.php

示例11: 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

示例12: ewww_image_optimizer_bulk_next

function ewww_image_optimizer_bulk_next($delay, $attachments)
{
    // toggle the resume flag to indicate an operation is in progress
    update_option('ewww_image_optimizer_bulk_ngg_resume', 'true');
    // need this file to work with metadata
    require_once WP_CONTENT_DIR . '/plugins/nextcellent-gallery-nextgen-legacy/lib/meta.php';
    foreach ($attachments as $id) {
        sleep($delay);
        // find out what time we started, in microseconds
        $started = microtime(true);
        // get the metadata
        $meta = new nggMeta($id);
        // retrieve the filepath
        $file_path = $meta->image->imagePath;
        // run the optimizer on the current image
        $fres = ewww_image_optimizer($file_path, 2, false, false, true);
        // update the metadata of the optimized image
        nggdb::update_image_meta($id, array('ewww_image_optimizer' => $fres[1]));
        // output the results of the optimization
        WP_CLI::line(__('Optimized image:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . $meta->image->filename);
        WP_CLI::line(sprintf(__('Full size - %s', EWWW_IMAGE_OPTIMIZER_DOMAIN), html_entity_decode($fres[1])));
        // get the filepath of the thumbnail image
        $thumb_path = $meta->image->thumbPath;
        // run the optimization on the thumbnail
        $tres = ewww_image_optimizer($thumb_path, 2, false, true);
        // output the results of the thumb optimization
        WP_CLI::line(sprintf(__('Thumbnail - %s', EWWW_IMAGE_OPTIMIZER_DOMAIN), html_entity_decode($tres[1])));
        // outupt how much time we spent
        $elapsed = microtime(true) - $started;
        WP_CLI::line(sprintf(__('Elapsed: %.3f seconds', EWWW_IMAGE_OPTIMIZER_DOMAIN), $elapsed));
        // get the list of attachments remaining from the db
        $attachments = get_option('ewww_image_optimizer_bulk_ngg_attachments');
        // remove the first item
        if (!empty($attachments)) {
            array_shift($attachments);
        }
        // and store the list back in the db
        update_option('ewww_image_optimizer_bulk_ngg_attachments', $attachments, false);
    }
    // reset all the bulk options in the db
    update_option('ewww_image_optimizer_bulk_ngg_resume', '');
    update_option('ewww_image_optimizer_bulk_ngg_attachments', '', false);
    // and let the user know we are done
    WP_CLI::success(__('Finished Optimization!', EWWW_IMAGE_OPTIMIZER_DOMAIN));
}
开发者ID:aaronfrey,项目名称:PepperLillie-CVM,代码行数:45,代码来源:iocli.php

示例13: display_thumb

 /**
  * display_thumb()
  *
  * This method displays the post thumbnail.
  *
  * @author Luca Grandicelli <lgrandicelli@gmail.com>
  * @copyright (C) 2011-2014 Luca Grandicelli
  * @package special-recent-posts-free
  * @version 2.0.4
  * @param $post The global WP post object.
  * @access private
  * @return mixed It could return the HTML code for the post thumbnail or false in case of some error.
  */
 private function display_thumb($post)
 {
     // Checking if featured thumbnails setting is active, if the current post has one and if it exists as file.
     if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
         // Fetching Thumbnail ID.
         $thumbnail_id = get_post_thumbnail_id($post->ID);
         // Checking if current featured thumbnail comes from the NExtGen Plugin.
         if (stripos($thumbnail_id, 'ngg-') !== false && class_exists('nggdb')) {
             try {
                 // Creating New NextGen Class instance.
                 $nggdb = new nggdb();
                 // Fetching NGG thumbnail object.
                 $nggImage = $nggdb->find_image(str_replace('ngg-', '', $thumbnail_id));
                 // Retrieving physical path of NGG thumbnail image.
                 $featured_physical_path = $nggImage->imagePath;
                 // Fetching NGG thumbnail image URL.
                 $featured_thumb_url = $nggImage->imageURL;
             } catch (Exception $e) {
             }
         } else {
             // Retrieving featured image attachment src.
             $featured_thumb_attachment = wp_get_attachment_image_src($thumbnail_id, 'large');
             // Retrieving physical path of featured image.
             $featured_physical_path = get_attached_file($thumbnail_id);
             // Retrieving featured image url.
             $featured_thumb_url = $featured_thumb_attachment[0];
         }
         // Parsing featured image url.
         $featured_thumb_url_obj = parse_url($featured_thumb_url);
         // Retrieving featured image basename.
         $featured_thumb_basename = pathinfo(basename($featured_thumb_url));
         // Removing querystring from image to save. This fixed the Jetpack Photon Issue.
         $featured_thumb_basename['extension'] = preg_replace('/\\?.*/', '', $featured_thumb_basename['extension']);
         // Building featured image cached path.
         $featured_thumb_cache = $this->cache_basepath . 'srpthumb-p' . $post->ID . '-' . $this->widget_args['thumbnail_width'] . 'x' . $this->widget_args['thumbnail_height'] . '-' . $this->widget_args['thumbnail_rotation'] . '.' . $featured_thumb_basename['extension'];
         // Checking if the thumbnail already exists. In this case, simply render it. Otherwise generate it.
         if (file_exists(SRP_PLUGIN_DIR . $featured_thumb_cache) || $this->generate_gd_image($post, 'featured', $featured_physical_path, SRP_PLUGIN_DIR . $featured_thumb_cache, $this->widget_args['thumbnail_width'], $this->widget_args['thumbnail_height'], $this->widget_args['thumbnail_rotation'])) {
             // Return cached image as source (URL path).
             $featured_thumb_src = SRP_PLUGIN_URL . $featured_thumb_cache;
             // Generating Image HTML Tag.
             $featured_htmltag = '<img src="' . $featured_thumb_src . '" class="srp-post-thumbnail" alt="' . esc_attr($post->post_title) . '" />';
         } else {
             // No featured image has been found. Trying to fetch the first image tag from the post content.
             $featured_htmltag = $this->get_first_image_url($post, $this->widget_args['thumbnail_width'], $this->widget_args['thumbnail_height'], $post->post_title);
         }
         // Checking if thumbnail should be linked to post.
         if ('yes' == $this->widget_args['thumbnail_link']) {
             // Building featured image link tag.
             $featured_temp_content = $this->srp_create_tag('a', $featured_htmltag, array('class' => 'srp-post-thumbnail-link', 'href' => get_permalink($post->ID), 'title' => $post->post_title));
         } else {
             // Displaying post thumbnail without link.
             $featured_temp_content = $featured_htmltag;
         }
     } else {
         // No featured image has been found. Trying to fetch the first image tag from the post content.
         $featured_htmltag = $this->get_first_image_url($post, $this->widget_args['thumbnail_width'], $this->widget_args['thumbnail_height'], $post->post_title);
         // Checking if returned image is real or it is a false value due to skip_noimage_posts option enabled.
         if ($featured_htmltag) {
             // Checking if thumbnail should be linked to post.
             if ('yes' == $this->widget_args['thumbnail_link']) {
                 // Building image tag.
                 $featured_temp_content = $this->srp_create_tag('a', $featured_htmltag, array('class' => 'srp-post-thumbnail-link', 'href' => get_permalink($post->ID), 'title' => $post->post_title));
             } else {
                 // Displaying post thumbnail without link.
                 $featured_temp_content = $featured_htmltag;
             }
         } else {
             // Return false.
             return false;
         }
     }
     // Return all the image process.
     return $featured_temp_content;
 }
开发者ID:alenteria,项目名称:vitrari,代码行数:87,代码来源:class-main.php

示例14: _wp_post_thumbnail_html

 /**
  * Output HTML for the post thumbnail meta-box.
  *
  * @see wp-admin\includes\post.php
  * @param int $thumbnail_id ID of the image used for thumbnail
  * @return string html output
  */
 function _wp_post_thumbnail_html($thumbnail_id = NULL)
 {
     global $_wp_additional_image_sizes, $post_ID;
     $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__('Set featured image') . '" href="' . esc_url(get_upload_iframe_src('image')) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     $content = sprintf($set_thumbnail_link, esc_html__('Set featured image'));
     $image = nggdb::find_image($thumbnail_id);
     $img_src = false;
     // get the options
     $ngg_options = nggGallery::get_option('ngg_options');
     if ($image) {
         if (is_array($_wp_additional_image_sizes) && isset($_wp_additional_image_sizes['post-thumbnail'])) {
             // Use post thumbnail settings if defined
             $width = absint($_wp_additional_image_sizes['post-thumbnail']['width']);
             $height = absint($_wp_additional_image_sizes['post-thumbnail']['height']);
             $mode = $_wp_additional_image_sizes['post-thumbnail']['crop'] ? 'crop' : '';
             // check fo cached picture
             $img_src = $image->cached_singlepic_file($width, $height, $mode);
         }
         // if we didn't use a cached image then we take the on-the-fly mode
         if ($img_src == false) {
             $img_src = trailingslashit(home_url()) . 'index.php?callback=image&amp;pid=' . $image->pid . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;mode=crop';
         }
         $thumbnail_html = '<img width="266" src="' . $img_src . '" alt="' . $image->alttext . '" title="' . $image->alttext . '" />';
         if (!empty($thumbnail_html)) {
             $ajax_nonce = wp_create_nonce("set_post_thumbnail-{$post_ID}");
             $content = sprintf($set_thumbnail_link, $thumbnail_html);
             $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__('Remove featured image') . '</a></p>';
         }
     }
     return $content;
 }
开发者ID:BGCX261,项目名称:zhibeifw-in-tibetan-svn-to-git,代码行数:38,代码来源:post-thumbnail.php

示例15: ewww_ngg_optimize

 function ewww_ngg_optimize($id)
 {
     // retrieve the metadata for the image
     $meta = new nggMeta($id);
     // retrieve the image path
     $file_path = $meta->image->imagePath;
     // run the optimizer on the current image
     $fres = ewww_image_optimizer($file_path, 2, false, false, true);
     // update the metadata for the optimized image
     nggdb::update_image_meta($id, array('ewww_image_optimizer' => $fres[1]));
     // get the filepath of the thumbnail image
     $thumb_path = $meta->image->thumbPath;
     // run the optimization on the thumbnail
     $tres = ewww_image_optimizer($thumb_path, 2, false, true);
     return array($fres, $tres);
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:16,代码来源:nextcellent-integration.php


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