Answer the question
In order to leave comments, you need to log in
How to store photos in the database?
Tell those who know! I thought about how to store photos in the database on the server is Mysql.
Each photo will be discussed in comments and put likes. If you store everything in one table, there will be a lot of photo entries.
how to implement each user his own database of photos. For example
usersDATA
-------users1
-----------photobase
-----------comments
-------users2
--------- --photobase
-----------comments
Answer the question
In order to leave comments, you need to log in
Save the path to the photo in BD. not the photo itself.
It is logical for each usera to create their own table in which there is a photo cell, and displays from there and not each comment to save the photo.
Do not store photos in the database, store them in a folder on disk by uuid, and store a unique URL in the database. This is normal practice.
Do not reinvent the wheel, you will get an overhead 5-7 times at least, and as soon as you have a base of 2-3 GB, everything will slow down.
Ideally, you need to get a very small database of two simple tables and a folder structure where you can store as many photos as you like with feedback via a web server
It is necessary to move the photo to a separate table of the type (id, blob) in the blob to store binary data, or if it breaks, then the path to the actual storage location, and use the id in other places where you need to refer to the pictures. Comments - also in a separate table, likes - in another one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question