Skip to content

Instantly share code, notes, and snippets.

@rgfx
Created November 5, 2017 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgfx/d19f4cc27482f0455cf5b988d43dfeba to your computer and use it in GitHub Desktop.
Save rgfx/d19f4cc27482f0455cf5b988d43dfeba to your computer and use it in GitHub Desktop.
Nextgen and Photoswipe integration
Use this plugin for wordpress
https://wordpress.org/support/plugin/lightbox-photoswipe/
/*
* Hide Nextgen styles and scripts
*/
if (!is_admin()) {
// goodbye NextGen junk
define('NGG_SKIP_LOAD_SCRIPTS', true);
function nextgen_styles()
{
wp_deregister_style('NextGEN');
}
add_action('wp_print_styles', 'nextgen_styles', 100);
}
<?php
/**
Template Page for the single pic
Follow variables are useable :
$image : Contain all about the image
$meta : Contain the raw Meta data from the image
$exif : Contain the clean up Exif data from file
$iptc : Contain the clean up IPTC data from file
$xmp : Contain the clean up XMP data from file
$db : Contain the clean up META data from the database (should be imported during upload)
Please note : A Image resize or watermarking operation will remove all meta information, exif will in this case loaded from database
You can check the content when you insert the tag <?php var_dump($variable) ?>
If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?>
**/
?>
<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?><?php if (!empty($image)) : ?>
<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>"
<?php echo $image->thumbcode ?>
data-width="<?php echo $image->meta_data['width'] ?>" data-height="<?php echo $image->meta_data['height'] ?>">
<?php if (!$image->hidden) { ?>
<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" />
<?php
} ?>
</a>
<?php if (!empty($image->caption)) : ?><span><?php echo $image->caption ?></span><?php endif; ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment