0

I have a very specific scenarion of storing images to mySql DB via PHP. Each image is send to server via POST request in JSON base64 encoded with other attributes and has in average 1MB. Image is written via PHP script to one dedicated table for images as string. Then it is usually read right after because of synchronization. Then it can be read several times in next 24 hours. Up to 20, average 2-3 times. Then image is not read anymore, only in special case it can be read by administrator. There are in average written 100-500 images in 24 hours range. Images older then 1 year are deleted.

In this case does it has benefit to change it and store images in file system ? a) Store it via PHP script in file system as copy of received base64 data (needs more space) b) Store it via PHP script in file system as jpg image (needs more performance)

Api via POST/JSON can not be changed I read a lot of articles about such problems, but I am asking specificaly for my scenario if it is worth to change it, and what will be gained.

maxxxo
  • 672
  • 3
  • 10
  • 28

1 Answers1

0

There are a lot things you must consider in order to know what is the best solution for you. Both approaches have their pros and cons. You gave to little information about your scenario. What's the average size os those images? What's the database size ?

You should check this thread:

Storing Images in DB - Yea or Nay?

Community
  • 1
  • 1
dvtelles
  • 200
  • 10
  • As mentioned average size of image in DB is 1 MB, Images are 99,9% of DB size. Max size od DB after one year is 5-6 GB – maxxxo Feb 05 '15 at 19:11