1

i'm developing an android app where the user can take a photo. The app will have to upload it. I'm new of servers/databases. What's better? Store the image file "image.jpg" on the server or store the image string, encoded with base64, in MySQL db?

Are there other strategies?

CONSIDER THAT i will have to reload the image to visualize it on the phone.

Antonello Gatto
  • 1,603
  • 2
  • 16
  • 29
  • have you read for example: http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay?rq=1 – andilabs Aug 29 '13 at 13:02

2 Answers2

1

i think better way is to store the images in a folder on the server and store their link in database..

Reasons

1) Normally time required to perform file operations is less than time required to perform database operations.

2) Updating the image is easy because its stored in file system which prevents the update operation on database which takes more time.

Girish Thimmegowda
  • 2,109
  • 2
  • 14
  • 15
0

I think it is not a good idea to store image string in database instead of just its path (image name). Store your image on server and its name or path in database. Because retrieving image string from db and creating image for it each time you need that image is expensive. So better store its name only in server.

Antonello Gatto
  • 1,603
  • 2
  • 16
  • 29
waseemwk
  • 1,499
  • 3
  • 15
  • 44
  • Yes but when i find it on the server i always have to re-encode it, transfer on the phone, and re-decode to attach it to the imageview, to visualize it! Haven't I? – Antonello Gatto Aug 29 '13 at 11:08
  • Yes if you want to send it to Mobile phone then it is wise to store it as a Base64 string in Db because it will save you conversion/decoding cost. – waseemwk Aug 29 '13 at 11:48