Should I store my images in the database or folders? [duplicate]

I’ve done it both ways recently and personally; I do prefer using the directory method for storing the images while keeping their properties in a DB.

Main reason: I had client to whom I made a website for. On the Webiste; there was a Photo Gallery section that allowed the user to upload new photos (which could be browsed from the public site).
Since my client hasnĀ“t thought on optimizing the images before uploading; the *.jpg was over 1mb.
I did implement the ability to update the image (once it was saved to the DB) but it had to be done one record at a time.

If this happens while storing the images in a directory, then the files can be saved locally, optimized and put back onto the server.

Here is an example

Leave a Comment