DEV Community

Discussion on: Saving images in a database or in the project's folder?

 
alex002i profile image
Alex

Hi :)), I am using Laravel. The blog is almost done, I am just wandering how should I save the photos. The markdown problem is already solved.

Thread Thread
 
htnguy profile image
Hieu Nguyen • Edited

you can store the image in the project, and later down the road, if it grows out of control, start outsourcing your image to AWS s3 or a similar service. The process flow for how this would be implemented is:

  1. you add image to aws s3 programmatically or manually using their web client
  2. you save the link to the image location in s3
  3. you update the img src tag to point to the s3 location.

Again this is kinda generic, but there should be plenty of tutorials on how to integrate s3 into your app. Note: you don't need a backend to programatically send images to s3, you can do it from your front end client, but most guides will advise you to refrain from doing this and instead use a backend as a gateway to protect your s3 code.

Thread Thread
 
alex002i profile image
Alex

Thanks, I didn't think about saving images in cloud.

Thread Thread
 
htnguy profile image
Hieu Nguyen

make sure to compress/process the image before uploading, since some high quality images will consume your storage.

Thread Thread
 
alex002i profile image
Alex

Yep, I know, thank you!