By default the NextGen gallery for wordpress requires you select the gallery to display when you use the shortcode [nggallery id=1]. However, you may note in the gallery itself you’ve already specified the page where the gallery is to be displayed (”Page Link to:”). So why select the gallery in the shortcode when the database already has this information. This short bit of code will allow you to manage the association in the gallery itself and no longer have to use the id parameter.

Add the following code to nggfunctions.php in nggShowGallery after $galleryID = (int) $galleryID;

    if(!$galleryID)
    {
    	$galleryByPost = $wpdb->get_results('SELECT gid FROM '.$wpdb->nggallery.' WHERE `pageid`= '.get_the_ID(), OBJECT_K);
    	if(is_array($galleryByPost))
    	{
    		$match = array_pop($galleryByPost);
    		$galleryID = (int) $match->gid;
    	}
    }

Now your page simply include [nggallery] and it will automatically determine the gallery. Or even better you can add this to your gallery page template.

<?php 	// show the gallery for this page
		if(function_exists('nggShowGallery')) echo nggShowGallery(0);
?>