本文整理汇总了PHP中C_Gallery_Storage类的典型用法代码示例。如果您正苦于以下问题:PHP C_Gallery_Storage类的具体用法?PHP C_Gallery_Storage怎么用?PHP C_Gallery_Storage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了C_Gallery_Storage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_digital_downloads
/**
* Gets all digital downloads for the pricelist
* @param null $image_id
* @return mixed
*/
function get_digital_downloads($image_id = NULL)
{
// Find digital download items
$mapper = C_Pricelist_Item_Mapper::get_instance();
$conditions = array(array("pricelist_id = %d", $this->object->id()), array("source IN %s", array(NGG_PRO_DIGITAL_DOWNLOADS_SOURCE)));
$items = $mapper->select()->where($conditions)->order_by('ID', 'ASC')->run_query();
// Filter by image resolutions
if ($image_id) {
$image = is_object($image_id) ? $image_id : C_Image_Mapper::get_instance()->find($image_id);
if ($image) {
$retval = array();
$storage = C_Gallery_Storage::get_instance();
foreach ($items as $item) {
$source_width = $image->meta_data['width'];
$source_height = $image->meta_data['height'];
// the downloads themselves come from the backup as source so if possible only filter images
// whose backup file doesn't have sufficient dimensions
$backup_abspath = $storage->get_backup_abspath($image);
if (@file_exists($backup_abspath)) {
$dimensions = @getimagesize($backup_abspath);
$source_width = $dimensions[0];
$source_height = $dimensions[1];
}
if (isset($item->resolution) && $item->resolution >= 0 && ($source_height >= $item->resolution or $source_width >= $item->resolution)) {
$retval[] = $item;
}
}
$items = $retval;
}
}
return $items;
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:37,代码来源:class.pricelist.php
示例2: protect_gallery
function protect_gallery($gallery, $force = false)
{
$retval = $this->object->is_gallery_protected($gallery);
if ($force || !$retval) {
$storage = C_Gallery_Storage::get_instance();
$gallery_path = $storage->get_gallery_abspath($gallery);
if ($gallery_path != null && file_exists($gallery_path)) {
$protector_files = $this->_get_protector_list();
foreach ($protector_files as $name => $protector) {
$path = $protector['path'];
$full_path = path_join($gallery_path, $path);
$full = null;
if (file_exists($full_path)) {
$full = file_get_contents($full_path);
$result = $this->_find_protector_content($full, $protector);
if ($result != null) {
$full = substr_replace($full, $protector['content'], $result['start'], $result['size']);
}
} else {
$full = $protector['tag-start'] . $protector['content'] . $protector['tag-end'];
}
file_put_contents($full_path, $full);
$retval = true;
}
}
}
return $retval;
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:28,代码来源:class.image_protection_manager.php
示例3: add_image
function add_image($image_id, $image_props)
{
// Get the items associated with the image
$items = array();
if (is_array($image_props)) {
unset($image_props['item_ids']);
if (isset($image_props['items'])) {
$items = $image_props['items'];
}
} else {
unset($image_props->item_ids);
if (isset($image_props->items)) {
$items = $image_props->items;
}
}
// Does the image exist?
if ($image = C_Image_Mapper::get_instance()->find($image_id)) {
$storage = C_Gallery_Storage::get_instance();
$image->thumbnail_url = $storage->get_thumbnail_url($image);
$image->dimensions = $storage->get_thumbnail_dimensions($image);
$image->width = $image->dimensions['width'];
$image->height = $image->dimensions['height'];
$this->_state[$image_id] = $image;
foreach ($items as $item_id => $item_props) {
if (is_numeric($item_id)) {
$this->add_item($image_id, $item_id, $item_props);
}
}
}
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:30,代码来源:class.nextgen_pro_cart.php
示例4: index_action
function index_action()
{
$this->enqueue_static_resources();
$settings = C_NextGen_Settings::get_instance();
$retval = $settings->proofing_user_confirmation_not_found;
if ($proof = C_NextGen_Pro_Proofing_Mapper::get_instance()->find_by_hash($this->param('proof'), TRUE)) {
$image_mapper = C_Image_Mapper::get_instance();
$images = array();
foreach ($proof->proofed_gallery['image_list'] as $image_id) {
$images[] = $image_mapper->find($image_id);
}
$message = $settings->proofing_user_confirmation_template;
if (preg_match_all('/%%(\\w+)%%/', $settings->proofing_user_confirmation_template, $matches, PREG_SET_ORDER) > 0) {
foreach ($matches as $match) {
switch ($match[1]) {
case 'user_name':
$message = str_replace('%%user_name%%', $proof->customer_name, $message);
break;
case 'user_email':
$message = str_replace('%%user_email%%', $proof->email, $message);
break;
case 'proof_link':
$message = str_replace('%%proof_link%%', $proof->referer, $message);
break;
case 'proof_details':
$imagehtml = $this->object->render_partial('photocrati-nextgen_pro_proofing#confirmation', array('images' => $images, 'storage' => C_Gallery_Storage::get_instance()), TRUE);
$message = str_replace('%%proof_details%%', $imagehtml, $message);
break;
}
}
$retval = $message;
}
}
return $retval;
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:35,代码来源:class.nextgen_pro_proofing_controller.php
示例5: index_action
function index_action($displayed_gallery, $return = FALSE)
{
// The HTML id of the gallery
$id = 'displayed_gallery_' . $displayed_gallery->id();
$image_size_name = 'full';
$display_settings = $displayed_gallery->display_settings;
if ($display_settings['override_image_settings']) {
$dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance();
$dyn_params = array();
if ($display_settings['image_quality']) {
$dyn_params['quality'] = $display_settings['image_quality'];
}
if ($display_settings['image_crop']) {
$dyn_params['crop'] = true;
}
if ($display_settings['image_watermark']) {
$dyn_params['watermark'] = true;
}
$image_size_name = $dynthumbs->get_size_name($dyn_params);
}
$params = array('images' => $displayed_gallery->get_included_entities(), 'storage' => C_Gallery_Storage::get_instance(), 'effect_code' => $this->object->get_effect_code($displayed_gallery), 'id' => $id, 'image_size_name' => $image_size_name, 'image_display_size' => $displayed_gallery->display_settings['image_display_size'], 'border_size' => $displayed_gallery->display_settings['border_size']);
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
// Render view/template
return $this->render_view('photocrati-nextgen_pro_blog_gallery#nextgen_pro_blog', $params, $return);
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:25,代码来源:adapter.nextgen_pro_blog_controller.php
示例6: render_displayed_gallery
/**
* Renders a feed for a displayed gallery
*/
public function render_displayed_gallery()
{
$displayed_gallery = NULL;
$mapper = C_Displayed_Gallery_Mapper::get_instance();
$template = $this->object->param('template');
if (!in_array($template, array('mediarss_feed', 'playlist_feed'))) {
$template = 'mediarss_feed';
}
$template = 'photocrati-mediarss#' . $template;
// Find the displayed gallery by it's database id
if ($id = $this->object->param('id')) {
$displayed_gallery = $mapper->find($id, TRUE);
} elseif ($transient_id = $this->object->param('transient_id')) {
// retrieve by transient id
$factory = C_Component_Factory::get_instance();
$displayed_gallery = $factory->create('displayed_gallery', NULL, $mapper);
$displayed_gallery->apply_transient($transient_id);
} elseif ($params = $this->object->param('params')) {
// Create the displayed gallery based on the URL parameters
$factory = C_Component_Factory::get_instance();
$displayed_gallery = $factory->create('displayed_gallery', json_decode($params), $mapper);
}
// Assuming we have a displayed gallery, display it!
if ($displayed_gallery) {
$storage = C_Gallery_Storage::get_instance();
$this->render_view($template, array('storage' => $storage, 'images' => $displayed_gallery->get_included_entities(), 'feed_title' => $this->object->_get_feed_title($displayed_gallery), 'feed_description' => $this->object->_get_feed_description($displayed_gallery), 'feed_link' => $this->object->_get_feed_link($displayed_gallery), 'generator' => $this->object->_get_feed_generator($displayed_gallery), 'copyright' => $this->object->_get_feed_copyright($displayed_gallery)));
} else {
$this->object->http_error('Invalid ID', 404);
}
}
开发者ID:radscheit,项目名称:unicorn,代码行数:33,代码来源:package.module.mediarss.php
示例7: get_storage
function get_storage()
{
if (!$this->storage) {
$this->storage = C_Gallery_Storage::get_instance();
}
return $this->storage;
}
开发者ID:jcwproductions,项目名称:jcwproductions-blog,代码行数:7,代码来源:source.class.php
示例8: flush_galleries
/**
* Flushes cache from all available galleries
*
* @param array $galleries When provided only the requested galleries' cache is flushed
*/
public function flush_galleries($galleries = array())
{
if (empty($galleries)) {
$galleries = C_Gallery_Mapper::get_instance()->find_all();
}
foreach ($galleries as $gallery) {
C_Gallery_Storage::get_instance()->flush_cache($gallery);
}
}
开发者ID:radscheit,项目名称:unicorn,代码行数:14,代码来源:package.module.cache.php
示例9: index_action
function index_action()
{
wp_dequeue_script('photocrati_ajax');
wp_dequeue_script('frame_event_publisher');
wp_dequeue_script('jquery');
wp_dequeue_style('nextgen_gallery_related_images');
$img_mapper = C_Image_Mapper::get_instance();
$image_id = $this->param('image_id');
if ($image = $img_mapper->find($image_id)) {
$displayed_gallery_id = $this->param('displayed_gallery_id');
// Template parameters
$params = array('img' => $image);
// Get the url & dimensions
$named_size = $this->param('named_size');
$storage = C_Gallery_Storage::get_instance();
$dimensions = $storage->get_image_dimensions($image, $named_size);
$image->url = $storage->get_image_url($image, $named_size, TRUE);
$image->width = $dimensions['width'];
$image->height = $dimensions['height'];
// Generate the lightbox url
$router = $this->get_router();
$lightboxes = C_Lightbox_Library_Manager::get_instance();
$lightbox = $lightboxes->get(NGG_PRO_LIGHTBOX);
$uri = urldecode($this->param('uri'));
$lightbox_slug = $lightbox->values['nplModalSettings']['router_slug'];
$qs = $this->get_querystring();
if ($qs) {
$lightbox_url = $router->get_url('/', FALSE, 'root');
$lightbox_url .= "?" . $qs;
} else {
$lightbox_url = $router->get_url($uri, FALSE, 'root');
$lightbox_url .= '/';
}
// widget galleries shouldn't have a url specific to one image
if (FALSE !== strpos($displayed_gallery_id, 'widget-ngg-images-')) {
$image_id = '!';
}
$params['lightbox_url'] = "{$lightbox_url}#{$lightbox_slug}/{$displayed_gallery_id}/{$image_id}";
// Add the blog name
$params['blog_name'] = get_bloginfo('name');
if ($lightbox->values['nplModalSettings']['enable_twitter_cards']) {
$params['enable_twitter_cards'] = $lightbox->values['nplModalSettings']['enable_twitter_cards'];
$params['twitter_username'] = $lightbox->values['nplModalSettings']['twitter_username'];
}
// Add routed url
$protocol = $router->is_https() ? 'https://' : 'http://';
$params['routed_url'] = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// Render the opengraph metadata
$this->expires('+1 day');
$this->render_view("photocrati-nextgen_pro_lightbox#opengraph", $params);
} else {
header(__('Status: 404 Image not found', 'nextgen-gallery-pro'));
echo __('Image not found', 'nextgen-gallery-pro');
}
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:55,代码来源:class.opengraph_controller.php
示例10: flush_galleries
/**
* Flushes cache from all available galleries
*
* @param array $galleries When provided only the requested galleries' cache is flushed
*/
public function flush_galleries($galleries = array())
{
global $wpdb;
if (empty($galleries)) {
$galleries = C_Gallery_Mapper::get_instance()->find_all();
}
foreach ($galleries as $gallery) {
C_Gallery_Storage::get_instance()->flush_cache($gallery);
}
// Remove images still in the DB whose gallery no longer exists
$wpdb->query("DELETE FROM `{$wpdb->nggpictures}` WHERE `galleryid` NOT IN (SELECT `gid` FROM `{$wpdb->nggallery}`)");
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:17,代码来源:package.module.cache.php
示例11: get_image_file_action
/**
* Read an image file into memory and display it
*
* This is necessary for htaccess or server-side protection that blocks access to filenames ending with "_backup"
* At the moment it only supports the backup or full size image.
*/
function get_image_file_action()
{
$order_id = $this->param('order_id', FALSE);
$image_id = $this->param('image_id', FALSE);
$bail = FALSE;
if (!$order_id || !$image_id) {
$bail = TRUE;
}
$order = C_Order_Mapper::get_instance()->find_by_hash($order_id);
if (!in_array($image_id, $order->cart['image_ids'])) {
$bail = TRUE;
}
if ($order->status != 'verified') {
$bail = TRUE;
}
if ($bail) {
header('HTTP/1.1 404 Not found');
exit;
}
$storage = C_Gallery_Storage::get_instance();
if (version_compare(NGG_PLUGIN_VERSION, '2.0.66.99') <= 0) {
// Pre 2.0.67 didn't fallback to the original path if the backup file didn't exist
$imagemapper = C_Image_Mapper::get_instance();
$fs = C_Fs::get_instance();
$image = $imagemapper->find($image_id);
$gallery_path = $storage->get_gallery_abspath($image->galleryid);
$abspath = $fs->join_paths($gallery_path, $image->filename . '_backup');
if (!@file_exists($abspath)) {
$abspath = $storage->get_image_abspath($image_id, 'full');
}
} else {
$abspath = $storage->get_image_abspath($image_id, 'backup');
}
$mimetype = 'application/octet';
if (function_exists('finfo_buffer')) {
$finfo = new finfo(FILEINFO_MIME);
$mimetype = @$finfo->file($abspath);
} elseif (function_exists('mime_content_type')) {
$mimetype = @mime_content_type($abspath);
}
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=' . basename($storage->get_image_abspath($image_id, 'full')));
header("Content-type: " . $mimetype);
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . @filesize($abspath));
readfile($abspath);
exit;
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:56,代码来源:adapter.ecommerce_ajax.php
示例12: upload_images
function upload_images()
{
$storage = C_Gallery_Storage::get_instance();
$image_mapper = C_Image_Mapper::get_instance();
$gallery_mapper = C_Gallery_Mapper::get_instance();
// Get Gallery ID
$galleryID = absint($_POST['galleryselect']);
if (0 == $galleryID) {
$galleryID = get_option('npu_default_gallery');
if (empty($galleryID)) {
self::show_error(__('No gallery selected.', 'nextgen-public-uploader'));
return;
}
}
// Get the Gallery
$gallery = $gallery_mapper->find($galleryID);
if (!$gallery->path) {
self::show_error(__('Failure in database, no gallery path set.', 'nextgen-public-uploader'));
return;
}
// Read Image List
foreach ($_FILES as $key => $value) {
if (0 == $_FILES[$key]['error']) {
try {
if ($storage->is_image_file($_FILES[$key]['tmp_name'])) {
$image = $storage->object->upload_base64_image($gallery, file_get_contents($_FILES[$key]['tmp_name']), $_FILES[$key]['name']);
if (get_option('npu_exclude_select')) {
$image->exclude = 1;
$image_mapper->save($image);
}
// Add to Image and Dir List
$this->arrImgNames[] = $image->filename;
$this->arrImageIds[] = $image->id();
$this->strGalleryPath = $gallery->path;
} else {
unlink($_FILES[$key]['tmp_name']);
$error_msg = sprintf(__('<strong>%s</strong> is not a valid file.', 'nextgen-public-uploader'), $_FILES[$key]['name']);
self::show_error($error_msg);
continue;
}
} catch (E_NggErrorException $ex) {
self::show_error('<strong>' . $ex->getMessage() . '</strong>');
continue;
} catch (Exception $ex) {
self::show_error('<strong>' . $ex->getMessage() . '</strong>');
continue;
}
}
}
}
开发者ID:igitur,项目名称:NextGen-Public-Uploader,代码行数:50,代码来源:class.npu_uploader.php
示例13: index_action
function index_action($displayed_gallery, $return = FALSE)
{
$id = $displayed_gallery->id();
$display_settings = $displayed_gallery->display_settings;
$current_page = (int) $this->param('nggpage', $displayed_gallery->id(), 1);
if (!isset($display_settings['images_per_page'])) {
$display_settings['images_per_page'] = C_NextGen_Settings::get_instance()->images_per_page;
}
$offset = $display_settings['images_per_page'] * ($current_page - 1);
$total = $displayed_gallery->get_entity_count();
$images = $displayed_gallery->get_included_entities($display_settings['images_per_page'], $offset);
if (in_array($displayed_gallery->source, array('random', 'recent'))) {
$display_settings['disable_pagination'] = TRUE;
}
if ($images) {
if ($display_settings['images_per_page'] && !$display_settings['disable_pagination']) {
$pagination_result = $this->object->create_pagination($current_page, $total, $display_settings['images_per_page']);
}
}
$pagination = !empty($pagination_result['output']) ? $pagination_result['output'] : NULL;
// Get named size of thumbnail images
$thumbnail_size_name = 'thumbnail';
if ($display_settings['override_thumbnail_settings']) {
$dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance();
$dyn_params = array('width' => $display_settings['thumbnail_width'], 'height' => $display_settings['thumbnail_height']);
if ($display_settings['thumbnail_quality']) {
$dyn_params['quality'] = $display_settings['thumbnail_quality'];
}
if ($display_settings['thumbnail_crop']) {
$dyn_params['crop'] = true;
}
if ($display_settings['thumbnail_watermark']) {
$dyn_params['watermark'] = true;
}
$thumbnail_size_name = $dynthumbs->get_size_name($dyn_params);
}
// Calculate image statistics
$stats = $this->object->get_entity_statistics($images, $thumbnail_size_name, TRUE);
$images = $stats['entities'];
$display_settings['longest'] = $stats['longest'];
$display_settings['widest'] = $stats['widest'];
// Enqueue dynamic stylesheet
$dyn_styles = C_Dynamic_Stylesheet_Controller::get_instance('all');
$dyn_styles->enqueue('nextgen_pro_film', $this->array_merge_assoc($display_settings, array('id' => $id)));
$params = array('images' => $images, 'storage' => C_Gallery_Storage::get_instance(), 'thumbnail_size_name' => $thumbnail_size_name, 'effect_code' => $this->object->get_effect_code($displayed_gallery), 'id' => $id, 'pagination' => $pagination);
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
// Render view/template
return preg_replace('~>\\s*\\n\\s*<~', '><', $this->render_view('photocrati-nextgen_pro_film#nextgen_pro_film', $params, $return));
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:49,代码来源:adapter.nextgen_pro_film_controller.php
示例14: index_action
function index_action($displayed_gallery, $return = FALSE)
{
$storage = C_Gallery_Storage::get_instance();
$list = $displayed_gallery->get_included_entities();
$thumbnail_size_name = 'thumbnail';
$ds = $displayed_gallery->display_settings;
if (!empty($ds['override_thumbnail_settings']) && $ds['override_thumbnail_settings']) {
$dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance();
$dyn_params = array('width' => $ds['thumbnail_width'], 'height' => $ds['thumbnail_height'], 'crop' => true);
$thumbnail_size_name = $dynthumbs->get_size_name($dyn_params);
}
$params = array('images' => $list, 'displayed_gallery_id' => $displayed_gallery->id(), 'storage' => $storage, 'custom_css_rules' => $this->object->get_custom_css_rules($displayed_gallery), 'thumbnail_size_name' => $thumbnail_size_name);
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
return $this->object->render_view('photocrati-galleria#galleria', $params, $return);
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:15,代码来源:adapter.galleria_controller.php
示例15: index_action
/**
* Renders the front-end display for the masonry display type
*
* @param C_Displayed_Gallery $displayed_gallery
* @param bool $return
* @return string
*/
function index_action($displayed_gallery, $return = FALSE)
{
$images = $displayed_gallery->get_included_entities();
if (!$images) {
return $this->object->render_partial("photocrati-nextgen_gallery_display#no_images_found", array(), $return);
} else {
$params = $displayed_gallery->display_settings;
$params['images'] = $images;
$params['storage'] = C_Gallery_Storage::get_instance();
$params['effect_code'] = $this->object->get_effect_code($displayed_gallery);
$params['displayed_gallery_id'] = $displayed_gallery->id();
$params['thumbnail_size_name'] = C_Dynamic_Thumbnails_Manager::get_instance()->get_size_name(array('width' => $params['size'], 'crop' => FALSE));
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
return $this->object->render_view('photocrati-nextgen_pro_masonry#index', $params, $return);
}
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:23,代码来源:adapter.nextgen_pro_masonry_controller.php
示例16: add_gallery
/**
* Parse the gallery/imagebrowser/slideshow shortcode and return all images into an array
*
* @param string $atts
* @return
*/
function add_gallery($atts)
{
global $wpdb;
extract(shortcode_atts(array('id' => 0), $atts));
$gallery_mapper = C_Gallery_Mapper::get_instance();
if (!is_numeric($id)) {
if ($gallery = array_shift($gallery_mapper->select()->where(array('name = %s', $id))->limit(1)->run_query())) {
$id = $gallery->{$gallery->id_field};
} else {
$id = NULL;
}
}
if ($id) {
$gallery_storage = C_Gallery_Storage::get_instance();
$image_mapper = C_Image_Mapper::get_instance();
foreach ($image_mapper->find_all_for_gallery($id) as $image) {
$this->images[] = array('src' => $gallery_storage->get_image_url($image), 'title' => $image->title, 'alt' => $image->alttext);
}
}
return '';
}
开发者ID:albinmartinsson91,项目名称:ux_blog,代码行数:27,代码来源:sitemap.php
示例17: import_image
/**
* Import an image from the filesystem into NextGen
*
* @synopsis --filename=<absolute-path> --gallery=<gallery-id>
*/
function import_image($args, $assoc_args)
{
$mapper = C_Gallery_Mapper::get_instance();
$storage = C_Gallery_Storage::get_instance();
if ($gallery = $mapper->find($assoc_args['gallery'], TRUE)) {
$file_data = @file_get_contents($assoc_args['filename']);
$file_name = M_I18n::mb_basename($assoc_args['filename']);
if (empty($file_data)) {
WP_CLI::error('Could not load file');
}
$image = $storage->upload_base64_image($gallery, $file_data, $file_name);
$image_id = $image->{$image->id_field};
if (!$image) {
WP_CLI::error('Could not import image');
} else {
WP_CLI::success("Imported image with id #{$image_id}");
}
} else {
WP_CLI::error("Gallery not found (with id #{$assoc_args['gallery']}");
}
}
开发者ID:radscheit,项目名称:unicorn,代码行数:26,代码来源:module.wpcli.php
示例18: index_action
function index_action($displayed_gallery, $return = FALSE)
{
// The HTML id of the gallery
$id = 'displayed_gallery_' . $displayed_gallery->id();
// Get named size of thumbnail images
$thumbnail_size_name = 'thumbnail';
$display_settings = $displayed_gallery->display_settings;
if ($display_settings['override_thumbnail_settings']) {
$dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance();
$dyn_params = array('width' => $display_settings['thumbnail_width'], 'height' => $display_settings['thumbnail_height']);
if ($display_settings['thumbnail_quality']) {
$dyn_params['quality'] = $display_settings['thumbnail_quality'];
}
if ($display_settings['thumbnail_crop']) {
$dyn_params['crop'] = true;
}
if ($display_settings['thumbnail_watermark']) {
$dyn_params['watermark'] = true;
}
$thumbnail_size_name = $dynthumbs->get_size_name($dyn_params);
}
$current_page = (int) $this->param('nggpage', $displayed_gallery->id(), 1);
$offset = $display_settings['images_per_page'] * ($current_page - 1);
$total = $displayed_gallery->get_entity_count();
$images = $displayed_gallery->get_included_entities($display_settings['images_per_page'], $offset);
if (in_array($displayed_gallery->source, array('random', 'recent'))) {
$display_settings['disable_pagination'] = TRUE;
}
if ($images) {
if ($display_settings['images_per_page'] && !$display_settings['disable_pagination']) {
$pagination_result = $this->object->create_pagination($current_page, $total, $display_settings['images_per_page']);
}
}
$pagination = !empty($pagination_result['output']) ? $pagination_result['output'] : NULL;
$params = array('images' => $images, 'storage' => C_Gallery_Storage::get_instance(), 'thumbnail_size_name' => $thumbnail_size_name, 'effect_code' => $this->object->get_effect_code($displayed_gallery), 'id' => $id, 'pagination' => $pagination);
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
// Render view/template. We remove whitespace from between HTML elements lest the browser think we want
// a space character ( ) between each image-causing columns to appear between images
return preg_replace('~>\\s*\\n\\s*<~', '><', $this->render_view('photocrati-nextgen_pro_thumbnail_grid#nextgen_pro_thumbnail_grid', $params, $return));
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:40,代码来源:adapter.nextgen_pro_thumbnail_grid_controller.php
示例19: _prepare_entities
function _prepare_entities($displayed_gallery, $thumbnail_size_name)
{
$current_url = $this->object->get_routed_url(TRUE);
$storage = C_Gallery_Storage::get_instance();
$mapper = C_Image_Mapper::get_instance();
$entities = $displayed_gallery->get_included_entities();
foreach ($entities as &$entity) {
$entity_type = intval($entity->is_gallery) ? 'gallery' : 'album';
// Is the gallery actually a link to a page? Stupid feature...
if (isset($entity->pageid) && $entity->pageid > 0) {
$entity->link = get_page_link($entity->pageid);
} else {
$page_url = $current_url;
if (intval($entity->is_gallery) && !$this->param('album')) {
$page_url = $this->object->set_param_for($page_url, 'album', 'galleries');
}
$entity->link = $this->object->set_param_for($page_url, $entity_type, $entity->slug);
}
$preview_img = $mapper->find($entity->previewpic);
$entity->thumb_size = $storage->get_image_dimensions($preview_img, $thumbnail_size_name);
$entity->url = $storage->get_image_url($preview_img, $thumbnail_size_name, TRUE);
}
return $entities;
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:24,代码来源:mixin.nextgen_pro_album_controller.php
示例20: set_post_thumbnail
/**
* Sets the post thumbnail for a post to a NextGEN Gallery image
* @param $args (blog_id, username, password, post_id, image_id)
*
* @return IXR_Error|int attachment id
*/
function set_post_thumbnail($args)
{
$retval = new IXR_Error(403, 'Invalid username or password');
$blog_id = intval($args[0]);
$username = strval($args[1]);
$password = strval($args[2]);
$post_ID = intval($args[3]);
$image_id = intval($args[4]);
// Authenticate the user
if ($this->_login($username, $password, $blog_id)) {
if (current_user_can('edit_post', $post_ID)) {
$retval = C_Gallery_Storage::get_instance()->set_post_thumbnail($post_ID, $image_id);
} else {
$retval = new IXR_Error(403, "Sorry but you need permission to do this");
}
}
return $retval;
}
开发者ID:sallf,项目名称:coopernature,代码行数:24,代码来源:module.nextgen_xmlrpc.php
注:本文中的C_Gallery_Storage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论