Umar Ghaffar
Umar Ghaffar

Reputation: 131

Display image using Glide and Retrofit from local computer memory

I have an android application which stores image in XAMMP (i.e C:\xammp\htdocs\php\imagefolder) at the time of registration. i am using XAMMP as local server, Retrofit for network activities and glide for image processing. Image is uploading successfully and image path is being stored in DATABASE. Now when i retrieve the information from database, i want to display that image in imageView using glide but i don't understand how i do that. In JSON response i am getting the path of the image and i am also fetching the json object from json array perfectly. But the problem is image is not loading with the help of glide

This is my image path retrieved from database imagefolder/1234abc.jg

This is actual path if image in my computer C:\xammp\htdocs\php\imagefolder\1234.jpg

and this is how i tried to load the image

Glide.with(this).load(ROOT_URL+OwnerPhoto).apply(RequestOptions.circleCropTransform()).into(header_imageview);



Glide.with(this).load(OwnerPhoto).apply(RequestOptions.circleCropTransform()).into(header_imageview);

and both methods failed

Upvotes: 0

Views: 512

Answers (1)

javadroid
javadroid

Reputation: 1431

have your device or emulator in same network or wifi, then on your computer find your ip address. must be like this: 192.168.x.x or etc

and use this ip address as ROOT_URL

instead of :

ROOT_URL = "C:\xammp\htdocs\php\imagefolder\1234.jpg"

use:

ROOT_URL = "http://192.168.x.x/php/imagefolder/1234.jpg"

hope it help you.

Upvotes: 1

Related Questions