0

i am working on a project where i must store files (png pictures). I have a lot of pictures. Actually, i insert records in a table which primary key is auto increment. I fetch the unique id of the record and i store my png file my renaming it (.png). This works great but i am looking for a cleaner solution. Do you think it is a good thing to store the pictures in a blob field ? I am wondering too if it is a good thing to store it in a json field (new feature of mysql store document)

Thanks

Bob5421
  • 7,757
  • 14
  • 81
  • 175
  • What is the need to store images as `blob`? If you are going to **store** a **lot** of pictures then beware of your **bandwidth**. – Hari Harker Sep 21 '16 at 05:13
  • 2
    Keeping large files outside the database and only storing the filepath is fairly normal. They're easier to work with as files. Not having to transfer large files reduces the bandwidth and load on the database (very important). If it's a web app all you need is the filename to create a URL, you don't actually need to download the whole image. What problems are you having with the existing solution? – Schwern Sep 21 '16 at 05:21
  • @Schwern thx. Our bots ping us with dupe call-outs (at least in some tags). – Drew Sep 21 '16 at 05:31
  • In fact, i want to store everything in the database because i want to backup ONE item: the database, and be sure i have everything in it. Is it a good way ? – Bob5421 Sep 21 '16 at 06:21
  • The MySQL JSON data type has a maximum size of one GB. If your picture are larger you could store them in multiple columns but that seems like a lot of effort. – Dave Stokes Aug 22 '18 at 21:31

0 Answers0