// look up for the path require_once dirname(dirname(__FILE__)) . '/ngg-config.php'; require_once NGGALLERY_ABSPATH . '/lib/meta.php'; require_once NGGALLERY_ABSPATH . '/lib/image.php'; if (!is_user_logged_in()) { die(__('Cheatin’ uh?')); } if (!current_user_can('NextGEN Manage gallery')) { die(__('Cheatin’ uh?')); } global $wpdb; $id = (int) $_GET['id']; // let's get the meta data' $meta = new nggMeta($id); $dbdata = $meta->get_saved_meta(); $exifdata = $meta->get_EXIF(); $iptcdata = $meta->get_IPTC(); $xmpdata = $meta->get_XMP(); ?> <!-- META DATA --> <fieldset class="options nggallery"> <h3><?php _e('Meta Data', 'nggallery'); ?> </h3> <?php if ($dbdata) { ?> <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3"> <thead>
/** * nggSinglePicture() - show a single picture based on the id * * @access public * @param int $imageID, db-ID of the image * @param int (optional) $width, width of the image * @param int (optional) $height, height of the image * @param string $mode (optional) could be none, watermark, web20 * @param string $float (optional) could be none, left, right * @param string $template (optional) name for a template file, look for singlepic-$template * @param string $caption (optional) additional caption text * @param string $link (optional) link to a other url instead the full image * @return the content */ function nggSinglePicture($imageID, $width = 250, $height = 250, $mode = '', $float = '', $template = '', $caption = '', $link = '') { global $post; $ngg_options = nggGallery::get_option('ngg_options'); // get picturedata $picture = nggdb::find_image($imageID); // if we didn't get some data, exit now if ($picture == null) { return __('[SinglePic not found]', 'nggallery'); } // add float to img switch ($float) { case 'left': $float = ' ngg-left'; break; case 'right': $float = ' ngg-right'; break; case 'center': $float = ' ngg-center'; break; default: $float = ''; break; } // clean mode if needed $mode = preg_match('/(web20|watermark)/i', $mode) ? $mode : ''; //let's initiate the url $picture->thumbnailURL = false; // check fo cached picture if ($post->post_status == 'publish') { $picture->thumbnailURL = $picture->cached_singlepic_file($width, $height, $mode); } // if we didn't use a cached image then we take the on-the-fly mode if (!$picture->thumbnailURL) { $picture->thumbnailURL = trailingslashit(home_url()) . 'index.php?callback=image&pid=' . $imageID . '&width=' . $width . '&height=' . $height . '&mode=' . $mode; } // add more variables for render output $picture->imageURL = empty($link) ? $picture->imageURL : $link; $picture->href_link = $picture->get_href_link(); $picture->alttext = html_entity_decode(stripslashes(nggGallery::i18n($picture->alttext, 'pic_' . $picture->pid . '_alttext'))); $picture->linktitle = htmlspecialchars(stripslashes(nggGallery::i18n($picture->description, 'pic_' . $picture->pid . '_description'))); $picture->description = html_entity_decode(stripslashes(nggGallery::i18n($picture->description, 'pic_' . $picture->pid . '_description'))); $picture->classname = 'ngg-singlepic' . $float; $picture->thumbcode = $picture->get_thumbcode('singlepic' . $imageID); $picture->height = (int) $height; $picture->width = (int) $width; $picture->caption = nggGallery::i18n($caption); // filter to add custom content for the output $picture = apply_filters('ngg_image_object', $picture, $imageID); // let's get the meta data $meta = new nggMeta($imageID); $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 singlepic-$template.php or pure singlepic.php $filename = empty($template) ? 'singlepic' : 'singlepic-' . $template; // create the output $out = nggGallery::capture($filename, array('image' => $picture, 'meta' => $meta, 'exif' => $exif, 'iptc' => $iptc, 'xmp' => $xmp, 'db' => $db)); $out = apply_filters('ngg_show_singlepic_content', $out, $picture); return $out; }
/** * 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; }