Products images in the same folder?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 лет назад
Hi,

Exists a subfolder division or Nopcommerce puts thousands and thousands of products images in the same folder?
13 лет назад
Ok,  I saw the code and the answer for my question is "NO".

so I just developed this function for divide the images in subfolders.

In this function i have used the same logic of the Document Management Systems creating groups of 256 folders for each folder and 256 images for each folder.
All this for 3 levels.

With this code you can store:
256x256x256 = 16.777.216 images for each root (like 5.592.405 products)

here's the code:


    public static string GetImagePath(int IdDoc, string ImageRootPath)
        {

            try
            {
                double subdir1 = 0;
                double subdir2 = 0;
                string dir1 = null;
                string dir2 = null;
                int val = 0;

                subdir1 = IdDoc / 65536;
                val = Convert.ToInt32(subdir1);
                dir1 = val.ToString("000");

                //calcolo subdir2
                subdir2 = IdDoc / 256;
                while (subdir2 >= 256)
                {
                    subdir2 = subdir2 - 256;
                }

                val = Convert.ToInt32(subdir2);
                dir2 = val.ToString("000");

                return ImageRootPath + "\\" + dir1 + "\\" + dir2 + "\\";
            }
            catch (Exception ex)
            {
                return "ERROR : " + ex.Message;
            }

        }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.