SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Jan 2012
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image Management Script

    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...

    Canis_lupus_Anatomy.jpg
    Canis_lupus_Physiology.png
    Canis_lupus_Diet.gif

    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:

    Canis_lupus_Anatomy_MoW_PD.jpg
    Canis_lupus_Ecology_ME_P.png

    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?

    Thanks.

  2. #2
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Definitely want to use database to manage such a large archive.

    Do NOT (cannot stress this enough) rely on naming convention for organization, because sometime in the future - there will be changes that will require a rewrite and/or ugly hacks to implement if you rely on this method.

  3. #3
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,367
    Mentioned
    80 Post(s)
    Tagged
    3 Thread(s)
    I would use a database with different tables containing various parts of the information joined.

  4. #4
    SitePoint Addict
    Join Date
    Jan 2012
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, database it is. Thanks for the tips!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •