Answer the question
In order to leave comments, you need to log in
How to store a large number of images on the server?
Now I am working on a project, in which every day a user will upload 10 images, about 50-70 users, the uploaded image should be stored for at least 1 month, what is the best way to organize this on the server? Store on your hosting or upload to another and store only a link? or are there other options?
Answer the question
In order to leave comments, you need to log in
If we are talking about Node.js, I can share my implementation.
But in general, files are stored by hashes, that is, if you, for example, have a file with a hash
then save it for example along the way
and in the database you write down what kind of file it is and what it is for.
Resizes or what other variants of the file can be stored like this
This method allows you to avoid duplicates and store a limited number of files in one folder (with a large number of files in one folder, the speed of the file system will slow down)
This is the basis, then there is already multi-server and various cache servers for files.
From myself I will add such a moment.
I just got in touch with this right now.
The site is on Bitrix, the owner uploaded photos in one folder, it has grown to 500 thousand pieces. And because of this, the entire site slows down despite the fact that it has its own dedicated and very powerful server. Tupit and all. We need to fix this problem so that the site works faster.
The solution is the following.
The folder in which all the pictures are stored must be divided into subfolders. and put pictures in there.
Done, the site came to life and began to work faster. The fact is that the file load of the server is heavily loaded, because you have to make a selection from all this heap of pictures only the ones you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question