I have a question about saving an image in a database, in specific mysql, my question is what would occupy more space in the server, save the bytes of the image in a field of type
bytes or save the image in a specific directory and then that directory to save it in a field of type
varchar , to then know which directory can go to find the image and show it
If I save the bytes of the image like this: let's say I have this table
int bytes id | imagen --------------- 1 | bytes[ ] 2 | bytes[ ]
I think that if I save it in this way the server will work more because to save it I would have to obtain the byte array of the image and then perform the insert of the array, then to be able to visualize the image I opened it to reconstruct it.
now if I keep it this way:
int varchar id | imagen --------------- 1 | mipagina.com/imagenes/test.png 2 | mipagina.com/imagenes/test1.png
would occupy less space in the database but the image would be saved in the specific directory, the disk space would increase faster because there are images that weigh more than 1MB.
What is more feasible? Someone who shares their experience, would appreciate your opinions. Greetings.