Akash Deshpande
Akash Deshpande

Reputation: 2645

Display facebook user images in PhoneGap (Android)

I have a very simple use case. I have an xhr object of ids of facebook users. Now I just want to display the images of the users in the following way.

    xhr.objects.forEach(function (user) {
 $('#userimage').append( '< img src="https://graph.facebook.com/"+user.user_id+"/picture/?type=small"/>');
                                                    });

For some reason this is not working. The images are not being displayed. I have added "https://graph.facebook.com" to allow access. Also images from the local web server are being displayed properly.

Upvotes: 2

Views: 2576

Answers (1)

Gunnar Karlsson
Gunnar Karlsson

Reputation: 28480

Your string should read

picture?type=small

not

picture/?type=small

So the correct URL is:

"https://graph.facebook.com/"+user.user_id+"/picture?type=small"

See how do I get a facebook users profile image through the fb api for details.

Upvotes: 5

Related Questions