We have been busy adding Product images to our new CS-Cart website and doing it in all three ways: Local, Server, and via URL
We are getting a little worried when we see where CS-Cart is storing the images. We can´t see any logic behind it. Will we have any future (upgrade) problems or data-feed problems?
Example 1: Images for product ABC added via ´Local´ upload stores in subfolder /images/1:
Main product image: http://samplestore.com/images[b]/detailed/1/[/b]ABC.PNG
Second image: http://samplestore.com/images[b]/detailed/1/[/b]ABC2.PNG
Question: is it normal that CS-Cart creates such a subfolder below /images? We assumed that all Product images would simply be saved directly under /images…
Example 2: Images for product DEF added via Local and some via URL
Main product image via Local: http://samplestore.com/images[b]/detailed/3/[/b]DEF.PNG
Third image via URL (URL inside the same CS-Cart installation):
http://samplestore.com/images[b]/detailed/4/[/b]DIMS.PNG
Question: Why now 2 different subfolders (/3 & /4)?
Question: Why different from Example 1 subfolder?
Thank you in advance for any insight.
Olof
It chooses the directory based on the formula of $dirnum = floor($image_id / MAX_FILES_IN_DIR);
MAX_FILES_IN_DIR is defined in config.local.php and is distributed as 1000.
So this takes the image_id of the image and then comes up with an integer to use as a sub-directory so that MAX_FILES_IN_DIR is not exceeded.
Otherwise for larger sites, too many image files can exist that will 1) impact performance and 2) can exceed system limits.
Thanks for such a quick reaction and explanation how CS-Cart does this.
So it seems that we should not worry about it. Glad to hear!