0

I wonder what the best way is to store large amount of images? Is saving the actual image file on my server disk and only the imagename in the database or saveing it as a base64 string in the database? Im saving them as image files at the moment And each file is about 40-100kb and just want some input about it.

Is a base64 image loading faster than a file image?

How are for example Instagram doing it?

Thanks.

Claes Gustavsson
  • 4,719
  • 7
  • 43
  • 71
  • No. It's not faster to retrieve a large chunk of data from a database table and convert it to an image to display than it is to simply read it from disk. But you could easily figure this out yourself with a little testing, couldn't you? – Ken White Feb 23 '20 at 00:22
  • Thanks Ken. Well yes, I have tested to upload and save file images and they become 50-100 kb and when I upload a base64 string and then convert it to an file image it becomes around 400 kb and thats why I asked to get input on this. And asking a question saving hours job isnt that what a forum is for ;-) – Claes Gustavsson Feb 23 '20 at 02:45
  • SO isn't a forum. It's a question and answer site, which is different. It's also not a substitute for making an effort to figure things out yourself first, or to avoid having to do any testing at all on your part. The question is what works best for you, and without testing at all you can't know. – Ken White Feb 23 '20 at 02:51
  • Well, its a simple question and if you don’t want to answer, just don’t answer haha. It’s as simple as that! – Claes Gustavsson Feb 23 '20 at 22:19
  • Look at the problem other way: is it cheaper to keep single copy of backed up images via rsync/whatever or store 1-30 copies of full database dump? – Maxim Sagaydachny Feb 26 '20 at 08:35
  • Does this answer your question? [Storing image in database directly or as base64 data?](https://stackoverflow.com/questions/9722603/storing-image-in-database-directly-or-as-base64-data) – Maxim Sagaydachny Feb 26 '20 at 08:57
  • Thanks Maxim. That clearifyed it. – Claes Gustavsson Feb 27 '20 at 10:58

0 Answers0