Well, maybe not (and I hope not), but I thought a challenge might bring out the best in you…
I need some help retrieving file information from a directory and using it to populate a table. Specifically I need the filename and date created for each file. I would like to be able to process these in a batch fashion. The table to which the information is being written is linked to a MySQL table on my website. The purpose of this whole thing is to manage image gallery meta data locally and with as much automation as possible (anyone who has manually managed a web image gallery will understand the need for automation). If you’re still with me, please read on…
The following needs to be done:
1) For each image in my local images directory (subdirectory “thumbs” to be ignored) a new record should be created. That record will consist of a number of fields, most of which will accept a default value every time. 3 fields will be dynamic, we will call them imageID, imageName, and imageDate for now, and the table images.
2) imageID will be an incremented ID number (autonumber is not an option as the table is a linked MySQL table),
3) imageName will be the filename with all spaces replaced with -‘s and the length shortened to (including .extension) 31 characters, and
4) imageDate will be the file’s Date Created.
VBA is quite acceptable (necessary probably) and I am open to comments and suggestions. I have been googling for a while to no avail. More details of my setup follow for those interested. Read on at the risk of boredom or wasted time.
The site, dbenton.com, is my personal site (in beta for now, so keep expectations low). It is to be an online diary, photo gallery, and general-information-about-me site. For diary management I chose the weblog software Moveable Type. I have decided to force MT to act as my gallery software as well. I did this for the following reasons:
-only manage users once
-multiple categories for each entry
-support for commenting
-search by category or date
-I like the template engine
-I couldn’t find (free) gallery management software that was even decent with the features I wanted
The steps I hope to take to take to take images from various sources to my website are as follows:
1) save images from various sources (friends, camera, scanner) in my incoming images directory
2) run a photoshop droplet on the directory which will resize, optimize, and rename (for greater compatibility) the files and save them to my outgoing images directory, and another that will create thumbnails in a directory under outgoing images called thumbs. (the original files will also be moved to another directory where they will await further instructions)
3) run the batch table-population script (macro, whatever) with which you lovely people are helping
4) put images from my outgoing images and thumbs directories to my site (and delete the files from the local directories)
5) “rebuild” MT files – a perl script that merges the moveable type templates with the database data and writes the site’s html
6) Some day, likely far in the future, manually update database with descriptions, photo credits, and keywords for each photo