In the past I've just used javascript to dynamically list all of the images and in the correct format (ie in a list, inside an anchor) and then use a jQuery gallery plugin in accordance. This does require your images to have similar names though.
You could also use PHP to read the contents of...