I'm developing a website that will focus on the animal kingdom (plants, too, actually), and I'm trying to figure out a way to manage thousands of images.

To put it in perspective, let's say there are 50,000 species of vertebrates, so I'd ideally like to have 50,000 images. However, I'd also like to obtain images to illustrate various sections. So for the wolf (Canis lupus), I might have the following images...


I also need to keep track of each image's source and status (e.g. permission vs public domain).

I'd probably put the images in folders arranged taxonomically. So all images of the wolf would go in a folder at Animals/Mammals/Carnivores/Canidae/, along with images of the coyote foxes, etc.

Does this sound like a good plan? If so, do you think it would be possible to create a PHP or regex script that would 1) display an image only if that image exists (regardless of extension; in other words, either Wolf_Diet.jpg or Wolf_Diet.png would display), 2) wrap the image in a div the same width as the image, with a default setting (e.g. float to the right) that I could override, and 3) extract information from the image's name?

Here's an example:


First, I'd insert an echo value in the Anatomy and Ecology sections on every carnivore page. So if you go to www.mysite.com/Life/Canis_lupus and scroll down to the heading "Anatomy," you would see $Canis_lupus_anatomy. Of course, you'd actually see the image Canis_lupus_Anatomy_MoW_PD.jpg

Since that image is 300 pixels wide, it would be wrapped in a div 300 pixels wide. The script would interpret MoW_PD as "Mammals of the World...Public Domain" and would display a caption: "Source: Mammals of the World, public domain."

The other option I've thought of is to put all the information in a database.

Anyway, do you think I'd be able to make a PHP/REGEX script that will do what I described above, or can you suggest a better solution?