-2

I am converting image as a byte array to store in the database in android. For this, I have to convert image both at the time of storing and reading. I can definitely store all image in variables during runtime at once but it might take a lot of space if there are a lot of images in the database. Does conversion actually take a lot of resources ? in that case I will use other methods to store like in file (I haven't used file before so will have to learn it first, trying to save effort :) ).

lcukerd
  • 83
  • 1
  • 10
  • I wonder where and how you have images. Mostly there are jpg files on phone storage. But images. Where? Putting a file in a byte array is pretty simple. And it is not called a conversion. – greenapps Mar 03 '17 at 19:46

1 Answers1

1

I think it depends on how many images are you planning to save in the database. For instance: if it is the user profile image, which is gonna be one image per user, I think it is okay. But, if it is something like images that the user can upload as many images as he likes, I don't really think it is a good idea. There are advantages and disadvantages on both.

There are plenty discussions about those two approaches:

Storing images in a database versus a filesystem

Why is it considered bad to store images in a database?

Storing Images in DB - Yea or Nay?

What is the best place for storing uploaded images, SQL database or disk file system?

Community
  • 1
  • 1
caiolopes
  • 561
  • 8
  • 14
  • 1
    Thanks for the help. After looking at links I guess it's better to store in a file. It will work faster and I don't want a laggy app. – lcukerd Mar 03 '17 at 17:19