Answer the question
In order to leave comments, you need to log in
Method for storing a large number of images on the site
Hello.
Here 's one of the responses that came up:
a good practice that is used in many places, for example, Microsoft
calculates md5 for a file - 2274facdbca56499fe397344c633e25a
put the file in the avatars/227/4fa/cdb/2274facdbca56499fe397344c633e25a.jpg folder
Answer the question
In order to leave comments, you need to log in
I will assume that this is done in order not to store the entire path to the
avatars/227/4fa/cdb/2274facdbca56499fe397344c633e25a.jpg file
, but only its name 2274facdbca56499fe397344c633e25a.jpg, from which you can easily restore the full path.
Plus, we still get the distribution of files into subfolders, which speeds up the file system.
increases the speed of listing a folder
easier to transfer, or even split files across multiple servers to
quickly find the desired file
Well, with the acceleration of work with the FS - by itself. Are there any other hidden benefits?
The speed of working with the FS increases (however, the web server does not care, it does not list, and chdir() is instant, regardless of the number of files).
Accidental overwriting of one file by another with the same name is excluded.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question