Ah, I see what you're doing...
- fs_filename
- fs_path
- thumb_filename
- thumb_path
The "filename" part is just fine for the full size and thumb size images. But the path you may find better stored in a script accessible file. But there's a few reasons to do this and not to do this. I'll explain and let you decide.
To save it in 1 spot (such as a file):
- Assumes all images are parked in one location (maybe have subdirectories for the different flavor of images such as thumb and full size)
- When you need to move the images, you update the path in 1 spot (copy images to new location, update config file to point to new location, delete images from old location = no down time in theory)
To save the path in the database:
- The path will be radically different for each image (if it is, it would be difficult to move all the files to a new location and then try updating the database to reflect the changes)
The key to think about here is the fewer places you have code specify a specific directory location, the easier it will be to update the code to point to a new directory. Storing it in the database will always work, but can get messy later on.
If you're still stuck on storing the path data in the database, you might decide to make a config table to hold the directory information. That would mean at the path is written just once and you could easily query it. There's several ways to do this...
As for your database design, 3 images and 3 prices, you will probably want to break this out into a seperate table.
Just ideas here...
Image Metadata Table:
- imetID
- imetTitle
- imetDescription
(imet - there's a pattern to creating this - let me know if you want an explanation behind it)
Image Table
- imagID
- imetID (this links up with the metadata)
- imagFilename
- imagType (enum, or ID to a type table)
- imagPrice (assuming price is based on image and not image type - if on image type, then you might put price in the image type table)
Then you left join the image table with the image metadata table. This setup would allow you to have 3 images, 2 images or 100 images per title.
There's a couple ways to do this. I just listed the first one that came to my mind...