• Hello
    I would like to know if there is any possibility to show easily the exif of my picture when somebody click of the picture from a gallery ?

    I use the lightbox plugin to show up the pics.

    Best would be to add a (exif) button next to the previsous/next close picture.

    Any idea ? thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • for now I just put the exif in the description and it shows up as the caption

    though this needs doing for each picture you want doing

    Thread Starter white-rabbit

    (@white-rabbit)

    This looks very awful and so far from the possibilities that WP + Nextgen + Lightbox could give us.

    By the way, when we click on the meta button in the admin panel, it already use a lightbox template to show the exif. So it should no be so hard to add a ‘exif’ button under the pics for visitors

    Thread Starter white-rabbit

    (@white-rabbit)

    no more idea ?

    Well I was after having the exif in the image description (which gets used for the lightbox caption) and tried messing around with the code

    Unfortunately my programming knowledge isn’t what it used to be and I decided to stop wasting time and just typed it in. Maybe in the future I won’t have to but for now it does the job.

    I got the same idea as you did from the fact that it shows up in the admin area but to no avail.

    As to it looking bad, I think that is a matter of opinion. I think it looks better than the display from the meta link. You can take alook if you like unseeingeye.com Still working on tweaking some things at the moment though.

    As for your suggestion of having a link to do that, i don’t see why it isn’t possible to lift the code for making that link in the admin area and putting it in the effects code you are using. Though it may not work cause of the variables used on that page might not be the same.

    Please post if you get it working though and how you did it.

    Thread Starter white-rabbit

    (@white-rabbit)

    Thanks for your reply.
    I will try next week to tweak the code from the lightbox effect with the one from the admin panel. Let’s hope there are no “admin level” limitation.

    Will let you know If I get anything

    Some idea, still working on it, at the moment only singlepic template:
    http://www.wrzesinscy.com/?p=88

    I’d be very interested in this as well. I’m not too great with php, so I’ve been manually typing it in. I’m sure there’s a better way.

    davidinjp

    (@davidinjp)

    I setup a pretty simple and automated way to do this with lightbox or floatbox. Sample of what it looks like: http://dave.jp/my-gallery/temples-and-shrines-2

    I modified /admin/functions.php so it automatically populates new photo descriptions. I just need to upload a new image or select “Import Meta data” for selected thumbs in the nextgen gallery admin panel to get the descriptions updated. It is simple this way. I also added tags to description.

    in admin/functions.php go to this code:

    foreach($imagesIds as $pic_id) {
    			$picture = nggdb::find_image($pic_id);
    			if (!$picture->error) {
    
    				$meta = nggAdmin::get_MetaData($picture->imagePath);
    
    				// get the title
    				if (!$alttext = $meta['title'])
    					$alttext = $picture->alttext;
    				// get the caption / description field
    				if (!$description = $meta['caption'])
    					$description = $picture->description;
    				// get the file date/time from exif
    				$timestamp = $meta['timestamp'];
    				// update database
    				$result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->nggpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", $alttext, $description, $timestamp, $pic_id) );
    				// add the tags
    				if ($meta['keywords']) {
    					$taglist = explode(',', $meta['keywords']);
    					wp_set_object_terms($pic_id, $taglist, 'ngg_tag');
    				} // add tags
    			}// error check
    		} // foreach
    
    		return true;
    
    	}
    
    	// **************************************************************
    	function get_MetaData($picPath) {
    		// must be Gallery absPath + filename
    
    		require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
    
    		$meta = array();
    
    		$pdata = new nggMeta($picPath);
    		$meta['title'] = $pdata->get_META('title');
    		$meta['caption'] = $pdata->get_META('caption');
    		$meta['keywords'] = $pdata->get_META('keywords');
    		$meta['timestamp'] = $pdata->get_date_time();	
    
    		return $meta;
    
    	}

    I changed mine to look like this:

    foreach($imagesIds as $pic_id) {
    			$picture = nggdb::find_image($pic_id);
    			if (!$picture->error) {
    
    				$meta = nggAdmin::get_MetaData($picture->imagePath);
    
    				// get the title
    				if (!$alttext = $meta['title'])
    					$alttext = ($meta['keywords'] . " " . $meta['camera']);
    				// get the caption / description field
    				if (!$description = $meta['caption'])
    					$description = ($meta['exif_desc'] . "" . $meta['keywords']);
    				// get the file date/time from exif
    				$timestamp = $meta['timestamp'];
    				// update database
    				$result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->nggpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", $alttext, $description, $timestamp, $pic_id) );
    				// add the tags
    				if ($meta['keywords']) {
    					$taglist = explode(',', $meta['keywords']);
    					wp_set_object_terms($pic_id, $taglist, 'ngg_tag');
    				} // add tags
    			}// error check
    		} // foreach
    
    		return true;
    
    	}
    
    	// **************************************************************
    	function get_MetaData($picPath) {
    		// must be Gallery absPath + filename
    
    		require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
    
    		$meta = array();
    
    		$pdata = new nggMeta($picPath);
    		$meta['title'] = $pdata->get_META('title');
    		$meta['caption'] = $pdata->get_META('caption');
    		$meta['keywords'] = $pdata->get_META('keywords');
    		$meta['timestamp'] = $pdata->get_date_time();
    		$meta['exif_desc'] = ($pdata->get_META('camera') . ", " . $pdata->get_META('focal_length') .  ", " . $pdata->get_META('shutter_speed') . ", " . $pdata->get_META('aperture') . ", ISO " . $pdata->get_META('iso') . ", " . $pdata->get_META('created_timestamp'));		
    
    		return $meta;
    
    	}

    (Note, there should be a properly formatted “< br / >” inside the empty quotes in ‘$description = ($meta[‘exif_desc’] . “
    ” . $meta[‘keywords’]);’
    above… I can’t get the br to stick when posting. )

    After updating functions.php as above, upload a new image, or just click on a thumb in the nextgen gallery admin panel and select “import metadata” from the drop down and click ok. You will see description field update with the exif and tags. You can still manually edit for certain images if you want to. This descrition should populate exif into lightbox, or floatbox in my case.

    You will see a “/br” in the admin panel description text box, that is there to force a line break/carriage return between exif data and tags. You can easily take that and the tags out of the code of course.

    I use floatbox, but it should work similar in lightbox as shown in my example: http://dave.jp/my-gallery/temples-and-shrines-2

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: NextGEN Gallery] Show exif with lightbox’ is closed to new replies.