G
G
Governor2017-09-09 04:29:43
MySQL
Governor, 2017-09-09 04:29:43

What is the best way to store product images on the site?

I want to create something like an online store. But I don't know how best to store product pictures. I haven’t tried storing pictures in the database yet, and I don’t know how to get them from there, but storing pictures in a separate folder, and searching by name from the database, I think it’s somehow not professional =) There will not be many goods within two hundred. Advise something, and what to read if stored in the database.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
ThunderCat, 2017-09-09
@Mr-Governor

Keep it unprofessionally, in a folder, as, in general, professionals do.
There is a file system - for files, there are databases - for data.

A
Andrey Zubkov, 2017-09-09
@zubkov_work

Store files on disk. The directory structure is something like this img / product category name / product name_unique number.jpg
In the database, make an additional field for the img product in which store the path to the file (without specifying the domain, that is, just img/phone/iphone_34234.jpg). On the product page, simply read this field and paste this path into the img src. Profit.

O
oh, 2017-09-09
well @AnneSmith

files are stored in the database if you need archives of documents that are required by law - then you don’t need to additionally maintain file archives
in your case there is absolutely no point in doing this,
even Facebook doesn’t do it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question