I had the need for something similar..
the code for the picture gallery initaly lists all sub directories in a specified folder as hyper links.. these directory names are used as the gallery names. the script then goes on and lists all of the image files using img tags to create thumbnails.. when a thumbnail is selected it opens the image in a new borwser window at full size.
in order to impement this you will need to look into file and directory manipulation with php. it did not take me to long to figure out how to make this work from the tutorials I used and I am new to all of this scripting and programming stuff..
here are some links to check out that should get you started..
http://www.devshed.com/c/a/PHP/File-And ... HP-part-1/
http://www.devshed.com/c/a/PHP/File-And ... HP-part-2/
I know that there is a better way to do this so I can add descriptions of the gallery's and captions to the images but I haven't gotten arround to that yet. This should get you going in the right directon though.
Here is a link to the site I have been working on to give you an idea of how I am using this code
http://www.undr8ed.com
A thought I had for the decsriptions and captions was to store that info in text files but I haven't experimented with it yet.