S
S
ssrdop2016-03-01 09:06:33
PHP
ssrdop, 2016-03-01 09:06:33

What is the best way to store product photos for an online store?

There is a need to store photos of goods for an online store. Each product has its own identification number (obtained by the usual increment), which corresponds to an image with the same number + .jpg extension. I know that it is not necessary to store many files in a folder, and the idea was to simply create a common images folder, and then create folders in it, in which I will store 300 files each. For example, I will store the first 300 products in folder 300, the next 300 products with numbers from 301 to 600 will be stored in folder 600, and so on. Is this practical or is there an easier way. It is important that I do not store a link or something else to images in the database.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DarkMatter, 2016-03-01
@darkmatter

"A lot" is how much? I store 30 thousand files in one folder - no problems))

A
Alexander Pryadko, 2016-03-01
@alexander_v_pryadko

Yes, this is the easiest way to not store a link to a photo in the database. In some systems, files are named not by a numeric identifier, but by a GUID and are arranged into folders named after part of the name (for example, the first 5 characters of the GUID). Instead of a GUID, you can use an MD5 hash of the content, in which case you can also control duplicates.

Z
Zaeba, 2019-10-25
@Zaeba

If you do not store a link to the image, then you will still need to store the name of the folder in which the image is located

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question