0

I am new to Android development. I am just trying to store an image in MySQL database and want to display that image in an ImageView.

What should I do?

I think I have to store the URL of image in MySQL database but I don't know how to do it either.

I am using PHP too.

mins
  • 6,478
  • 12
  • 56
  • 75

2 Answers2

1

One method is to store the base64 version of image using a php script with base64_encode() wich returns the base64 encryption of the image but i don't recommend it because this is increasing the size of the image. You should upload the image to a server and only store in the database the path to the image and then load it inside the Android application. Here is a nice Java tutorial that explains how to upload an image through HTTP http://www.jguru.com/faq/view.jsp?EID=62798 it should work for your application.

Alexandru
  • 117
  • 1
  • 4
  • 19
0

Try to avoid if you can, storing images in database (as it would increase the size)..
If you cannot avoid, try using BLOB in database.. as mentioned here.

NOTE: Also do some research before asking questions.

Community
  • 1
  • 1
Ankit Bansal
  • 1,801
  • 17
  • 34