I saw a couple PHP/mySQL versions a year or so ago when I was looking. I'm sure there's several nicely functional ones up by now.

Some of them store the images in the database and you need to go through a webserver with PHP to access them. Others just use a PHP frontend to populate the database and a file structure. Go for one of the second type. Once everything is built, you should be able to copy tie filesystem to disk.