WordPress.org

Forums

EXIF Information display in Lightview Plus or Lightbox (5 posts)

  1. charlesleo
    Member
    Posted 7 years ago #

    Hi.

    Does anyone know how to accomplish this?

    I've seen it done on this page:
    http://kruyt.org/

    He specifies the code below: but where does he put it?!?!?!

    What I mean with thickbox, is I auto load it in the plugin. no need to embed in my theme. And thickbox is already by default in WP2.5

    code for using the tb in wp:

    wp_enqueue_script('thickbox');
    add_action('wp_head', 'thickbox_css');
    
    function thickbox_css() {
    
        $thickbox_csspath = get_bloginfo('wpurl')."/wp-includes/js/thickbox/thickbox.css";
        $thickboxscript = "\n";
        print($thickboxscript);
    }

    Then:

    And here some code I use to put the exif info that wp 2.5 now reads from files in the title, so the ‘boxes’ can use it to. To display exif.

    // Get EXIF from WP and set in title
    $metadata = wp_get_attachment_metadata($id);
    $image_meta = $metadata[image_meta];
    
    //print_r ($metadata);
    
    if($image_meta[camera]) $title = ”.$image_meta[camera].’ ‘;
    if($image_meta[focal_length]) $title .= ‘@ ‘.$image_meta[focal_length].’ mm ‘;
    if($image_meta[shutter_speed]) $title .= ‘- ¹/’.(1/($image_meta[shutter_speed])).’ sec’;
    if($image_meta[aperture]) $title .= ‘, ƒ/’.$image_meta[aperture].”;
    if($image_meta[iso]) $title .= ‘, ISO ‘.$image_meta[iso].”;
    if($image_meta[created_timestamp]) $title .= ‘ on ‘.date(’j F, Y’,$image_meta[created_timestamp]).”;
  2. mihai2k
    Member
    Posted 6 years ago #

    Hello ! I've had the same issue as you.
    But i've solved it !

    check this url : http://www.albumihai.ro
    click on a photo and see the exif data.
    I have made some modifications into the script, i don't know if i'm "authorized" to do this, or if is secure what i've made, but here is the solution.

    go to : /wp-content/plugins/nextgen-gallery
    and edit: nggfunctions.php

    and look after "

    <?php
    
    if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page di
    rectly.'); }

    this should be on the first two lines.

    After that paste this function code:

    function show_meta_exif($id){
    
    require_once(NGGALLERY_ABSPATH.'/lib/nggmeta.lib.php');
    
    global $wpdb;
    
    // let's get the image data
    $picture  = new nggImage($id );
    // let's get the meta data'
    $meta = new nggMeta($picture->absPath);
    $exifdata = $meta->get_EXIF();
    
    $exif = $exifdata[camera] .' @ '. $exifdata[focal_length]. ' - '.$exifdata[shutter_speed].', ' . $exifdata[aperture]
     .', ISO  '.$exifdata[iso];
    return $exif;
    
    }

    And now search for something like:

    $out .= '<a href="'.$link.'">description).'" '.$thumbcode.' >';
    in the same nggfunctions.php file

    and comment that line with two "//" slashes
    and paste before that line, this code:

    $out .= '<a href="'.$link.'" title="'.stripslashes(show_meta_exif($picture->pid)).'" '.$thumbcode.' >';

    THAT'S IT!

    Now when you click on the photo , the title information will be something like this:

    title="Canon EOS 400D DIGITAL @ 49 mm - 1/200 sec, F 13, ISO 100e"

    I WILL NOT BE RESPONSIBLE FOR ANY DAMAGE OF YOUR nextgen-gallery plugin OF FOR ANY SECURITY HOLE.

  3. joikem
    Member
    Posted 6 years ago #

    Hi!

    Sounds very cool, but I cannot find this line in my nggfunctions.php:

    $out .= '<a href="'.$link.'">description).'" '.$thumbcode.' >';

    I use NextGEn Gallery 0.98. Can you update your solution?

    Thx very much,
    Johannes

  4. siUUL
    Member
    Posted 6 years ago #

    it's work! many thank to charlesleo and mihai2k :)

  5. garethooper
    Member
    Posted 6 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic