I've written a gallery/photo album script but I can't seem to find it on this computer. It might be online somewhere, I'll let you know if I find it.
I think what I did was I had a form that uploaded the picture and saved the filename and dimensions to a text file. Then the actual album opened the text file, retrieved the filename and opened the file, and then made a thumbnail by dividing the dimensions by 5.
Er... sorry that wasn't very specific. Hope it helped.