I am implementing an image upload system in PHP, The following are required:
- Have categories
- Allow users to comment on images
- Allow rating of images
For that, I have 2 approaches in mind:
1. Implement the categorization by folders
Each category will have its own folder, and PHP will detect categories via those folders.
Pros
- Structured look, easily locatable images.
- Use of native PHP functions to manipulate and collect information about folders and files
Cons
- Multiple categorization is a pain
- Need to save the full path in the database
2. Implement the categorization by database
Each image in the database will have a catID (or multiple catIDs), and PHP will query the database to get the images
Pros
- Easily implemented multi-categories
- Only image name is saved
Cons
- Seems more messy
- Need to query the database a lot.
Which do you think is better? Or is there a third, completely different, approach that I'm missing?
Just a note, I don't need code, I can implement that myself, I'm looking to find what to implement.
Would love to hear from you.