Hi cuteantonyraj,
I've been looking into this for you, and there appears to be some issues between the two plugins at the moment. Don't worry, you're not alone!
However, I have managed to get NextGEN Gallery's images listed in WordPress SEO's sitemaps by editing NextGEN's sitemap file at wp-content/plugins/nextgen-gallery/lib/sitemap.php (thanks to this and this).
If you navigate to Plugins --> Editor --> NextGEN Gallery --> "nextgen-gallery/lib/sitemap.php" and replace all the code with the following, you should be all up and running...
<?php
/**
* Main PHP Class for XML Image Sitemaps
*
* @author Alex Rabe
* @version 1.0
* @copyright Copyright 2011
*
*/
class nggSitemaps {
var $images = false;
/**
* nggSitemaps::__construct()
*
* @return
*/
function __construct() {
add_filter('wpseo_sitemap_urlimages', array( &$this, 'add_wpseo_xml_sitemap_images'), 10, 2);
}
/**
* Filter support for WordPress SEO by Yoast 0.4.0 or higher ( http://wordpress.org/extend/plugins/wordpress-seo/ )
*
* @since Version 1.8.0
* @param array $images
* @param int $post ID
* @return array $image list of all founded images
*/
function add_wpseo_xml_sitemap_images( $images, $post_id ) {
$this->images = $images;
// first get the content of the post/page
$p = get_post($post_id);
// Backward check for older images
$p->post_content = NextGEN_Shortcodes::convert_shortcode($p->post_content);
// Don't process the images in the normal way
remove_all_shortcodes();
// We cannot parse at this point a album, just galleries & single images
add_shortcode( 'singlepic', array(&$this, 'add_images' ) );
add_shortcode( 'thumb', array(&$this, 'add_images' ) );
add_shortcode( 'nggallery', array(&$this, 'add_gallery') );
add_shortcode( 'imagebrowser', array(&$this, 'add_gallery' ) );
add_shortcode( 'slideshow', array(&$this, 'add_gallery' ) );
// Search now for shortcodes
do_shortcode( $p->post_content );
return $this->images;
}
/**
* 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 ));
// backward compat for user which uses the name instead, still deprecated
if( !is_numeric($id) )
$id = $wpdb->get_var( $wpdb->prepare ("SELECT gid FROM $wpdb->nggallery WHERE name = '%s' ", $id) );
$images = nggdb::get_gallery($id, 'pid', 'ASC', true, 1000);
foreach ($images as $image) {
$src = $image->imageURL;
$newimage = array();
if ( !empty($image->title) )
$newimage['title'] = $image->title;
if ( !empty($image->alttext) )
$newimage['alt'] = $image->alttext;
$newimage['src'] = $image->imageURL;
$this->images[$src] = $newimage;
}
return;
}
}
$nggSitemaps = new nggSitemaps();
Note 1: You may need to click the "Save Settings" button at SEO --> XML Sitemaps afterwards in order to re-build your sitemaps, and also clear out any caching plugins you have installed to see them update.
Note 2: What you're looking for in your sitemaps are the image counts when you click-through to /post-sitemap.xml and /page-sitemap.xml from http://www.yoursite.com/sitemap_index.xml. The totals should now include your images from NextGEN. Also, if you look at the post/page sitemap's source code in your browser (often View --> View Source), you'll now see the full URLs for all of your images nested below each post listing.
I hope this helps!
Cheers,
Mark.