How to organize images for delivery performance in a website
I've a website with listings and images associated with each listing.
I currently have images organized like this in the file system:
D:\Images\Original
D:\Images\Thumbnail
Each listing can have up to 12 images in the original size and in the thumbnail size.
I'm wondering how to best organized the images in the file system to get better performance in terms of locating the images for a listing.
I'm thinking about this organization:
For listing with Id 101:
D:\Images\Original\101
D:\Images\Thumbnail\101
For listing with Id 102:
D:\Images\Original\102
D:\Images\Thumbnail\102
etc.
In other words, each listing will have a folder (named after the listing Id). In that folder, you only have images for 开发者_如何学运维that particular listing.
Are there better ways to organize the listing images? I almost have 1 million images in total.
Personally, I would keep related images together. Otherwise you're creating a maintenance nightmare. So:
D:\Images\102\imagename_raw.png
D:\Images\102\imagename_1024_786.png
D:\Images\102\imagename_40_40.png
And then
D:\Images\103\imagename_raw.png
D:\Images\103\imagename_1024_786.png
D:\Images\103\imagename_40_40.png
That way, everything is in one place, consistent and concise.
精彩评论