1
Answers
Vote up!
0
Vote down!

Organise the number of images in one folder. Create folder datewise option

I have a drupal commerce based website and with more than 5000 products live now. All the images are stored in one folder and frequently I receive timeout messages when I create new product display with images.
Is there any way we can organise the imagefiles as 1000 image files per folder or any way we can store it dynamically datewise or monthwise in a subfolder.so that it would be easy for the system to search from the smaller images per folder.
Can any one help with right way to do it in drupal.
Already stored images cannot be moved since it creates problem with SEO.
But if atleast if we could upload the new files datewise, monthwise folders.
Any help would be much appreciated.
Also, for any new ecommerce websites, please configure this option earlier so that on long run, when we upload thousands of image files, we need not worry about timeout messages.

Asked by: gnvinod
on December 6, 2015

1 Answer

Vote up!
0
Vote down!

I am already using Token and so I tried to change the image field by using the link admin>structure>content types>product>manage fields.

I clicked edit in image field and was able to find a default directory named products for saving product images.

Since that field supports token, I simply replaced the folder name products with
[current-date:custom:Y]/[current-date:custom:m]

I again tried to create a new product, then I was able to see the path as follows.
sites/default/files/2015/12/product.jpg

So, this replaced the folder named products with current year/current month. So each and every month a new folder gets created and images will be stored based on number of additions per month instead of all the images stored in one folder.

This is currently working. If any better ideas, please suggest. Thank you

Answer by: gnvinod
Posted: Dec 8, 2015