0
It is the following people, maybe this is very basic, but how do I associate the image of an image folder for example to the user id 1 in the bank? Will user 1 have image 01 of the img folder? Would you recommend creating the "folder path" with the name of the image in the database and create a relationship with the user table? Or have other techniques more useful and currently used for this?
Just one question, I don’t know if you can, but do you know how I would make each user have more than one related image? And thank you very much!
– Asura Khan
@In this case you should create a table to store the paths. A table for example,
UsuariosAvatares
with the columnsid
,usuario_id
andavatar
. It is also possible, if you have a limit of two images, for example, to use a separator in the record:img/avatares/123.jpg;img/avatares/321.png
so you’d only make onesplit()
in the;
and would have aarray
with the paths of the images.– user3603
Caraka, perfect! I completely forgot about Split. And you said I’d like to create this "img/avatars/123456.jpg", this 123456 would be the id? Or it could be a random number?
– Asura Khan
@Asurakhan can be the name of the image or anything you find interesting. I like to put
timestamp
so I don’t run the risk of having images with duplicate names and end up overwriting one of them. That way it would be something likeimg/avatares/17072015150955.jpg
– user3603
So when you upload the image to the folder, I also add the path to the database in a normal register with id and information?
– Asura Khan
@Exact Asurakhan =)
– user3603