Chances are, if you want to do it, the geniuses behind PHP have predicted it.
http://www.php.net/manual/en/ref.dir.php
Use those commands to read all the files in the picture directory. Although if you want to sort them you would have to have some sort of file naming convention that contains the date so your script can tell how to organize it.
One suggestion would be to mix mysql and this directory reading method. Have an admin script that you run everytime you dump a bunch of files in the folder. The script compares the new directory to the current list in the mysql db and adds the new files into the mysql db using the current date and time.