I am in the process of developing a blog system. Users will be able to upload multiple images to a particular blog entry. I am going to store the images in the file system.
My question is where to store the uploaded images? I have found some answers like below.
1. create folder for every blog with ID and store the images related to that blog.
Images for Blog ID 1000000001 would be stored in folder: 10/00/00/00/01/abc.jpg
2. create folders by year and month (from blog entry creation date).
Images for 2011/Mar will be store in folder : /images/blog/2011/03/abc.jpg.
3. create folders by user id (the user who uploads the images).
Images for User ID 1000000001 would be stored in folder: 10/00/00/00/01/abc.jpg
I need to know which one is the efficient method.
I am planning to use CKEditor with CKFinder to edit and upload images. When the user uploads the images using CKFinder the images will be uploaded in the filesystem and <img> tag will be placed in the textarea. In this scenario How to store the uploaded images path to the db? Because later If I want to delete the blog , I should be able to delete all the images related to that blog.