Retrieving links and names of images from a NextGEN gallery [closed]

Ok, this has worked for me.

<?php 
// get the track list 
global $nggdb;
    $gallery = $nggdb->get_gallery ($galleryID, 'sortorder', 'ASC', true, 0, 0);
?>
<div id="tracklist">
<?php foreach($gallery as $image) { ?>
<div class="single_image" id="image-<?php echo $image->pid; ?>">
    <a href="https://wordpress.stackexchange.com/questions/75475/<?php the_permalink() ?>&pid=<?php echo $image->pid;?>" title="<?php echo $image->title; ?>">
        <?php echo $image->alttext; ?>
    </a>
</div>
<?php } ?>
</div>