Mahmoud.sh's avatar

How to store images using mysql?

I've made a small e-commerce website using vanilla PHP some time ago, I stored the products info in Mysql database, and I stored the images of the product as a path to the uploaded image by the shop owner, now I am developing another e-commerce website but using Laravel8, the question is how do you recommend me to store the images of the products? can I use Mysql to store images? or should I store the images in a directory and link their path to Mysql database?

0 likes
3 replies
Nakov's avatar

Yes, that the only good way to go. You store them in either local storage or any of the 3d party services like Amazon S3 or Google cloud storage and just store the path to the image in the database.

Mahmoud.sh's avatar

@Nakov what would you recommend, a third party or local storage? And thanks for the advice

Nakov's avatar
Nakov
Best Answer
Level 73

it really depends. That’s up to you more based on the budget. And of course more protection, and how big of a storage you have on the server. Good thing is that Laravel offers great support for all and it is easy to switch. So I would start with local unless I know I’ll need more space and easier backup, then I’ll move to S3 for example.

1 like

Please or to participate in this conversation.