This should be a console PHP script that queries a MySQL database for all existing entries and then deletes jpg files if the file has no matching dB entry.
Active photos are named such as [url removed, login to view], [url removed, login to view], [url removed, login to view], etc., and the matching dB entry has a field containing "12345". JPG files which
**do** have matching dB entries should not be deleted. Maximum number of entries in the table can be up to 400, and each entry can have up to 25 photos associated with it. The script will be set up to run via cron on a frequent basis so that the number of photos that need to be deleted on any one pass can be kept to a minimum. I would estimate that no more than 5-10 entries would need to have their associated photos removed per pass. There will be a config section of the script where the db/table/user/pass can be easily specified.