Answer the question
In order to leave comments, you need to log in
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
Keep it unprofessionally, in a folder, as, in general, professionals do.
There is a file system - for files, there are databases - for data.
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question