Operation Gadget points to an arcticle on O’Reilly on setting up a Digital Photo Gallery with MySQL, Sendmail, Perl and ImageMagick. To me unless you just really want to do it yourself, this is way more work that you need to even consider. I’ve been happily using Gallery and the excellent plug-in for iPhoto, iPhotoToGallery, which lets me export directly from iPhoto into my web Gallery. It’s simple and quick. Once you setup the style and prefs in the Gallery app, you are good to go.
Automated Web Photo Galleries with iPhoto and Perl by Mike Schienle — If iPhoto is working nicely as your digital shoebox, but you want to automate the process of creating web galleries for your own server, here’s a nifty setup using Sendmail, MySQL, and Perl. Mike Schienle, who specializes in task automation for a living, shows you the system he designed for his wife, who is an avid photographer.