Samer Samer
Samer Samer

Reputation: 93

Get a user's photo in the size of the profile photo

I'm developing website Facebook application using C#. I can get the information using:

FacebookClient FBApp = new FacebookClient(getAccessToken);
dynamic user = FBApp.Get("/me");

and I can get a user's friends by:

dynamic friends = FBApp.Get("/me/friends");

All this does not contain any links to the photo. I can get the user photo using the link https://graph.facebook.com/*[user_id]*/picture.

But this shows a very small photo... How can I get the photo in a size similar to the size of the profile photo?

Upvotes: 3

Views: 7102

Answers (5)

Daniele Liberti
Daniele Liberti

Reputation: 1

To get a facebook user profile picture of a specific size, call

graph.facebook.com/USER_ID/picture?width=900

Upvotes: 0

vinabyte
vinabyte

Reputation: 1

You can get picture by this way: https://graph.facebook.com/v2.2/search?fields=id,picture&q={your query}&type=user&access_token=AccessToken

Upvotes: -1

lenhhoxung
lenhhoxung

Reputation: 2776

@Gunnar Karlsson is true, but the sizes (in pixels) of pictures are not the same. For example, 180x180;180x135. The aspect depends on the original uploaded picture

Upvotes: 0

Gunnar Karlsson
Gunnar Karlsson

Reputation: 28480

To get a user profile picture of a specific size, call

https://graph.facebook.com/USER_ID/picture?type=SIZE

where SIZE should be replaced with one of the words

square
small
normal
large 

depending on the size you want.

This call will return a URL to a single image with its size based on your chosen type parameter.

For example:

https://graph.facebook.com/USER_ID/picture?type=large

returns a URL to a large version of the image.

Upvotes: 15

BenLanc
BenLanc

Reputation: 2434

Try FQL:

SELECT pic_square FROM user WHERE uid IN(SELECT uid2 FROM friend WHERE uid1 = me())

...where pic_square can be one of pic_small, pic_big, pic_square, pic

That'll give you URLs for the corresponding user's friends' profile picture at the given size.

e.g.:

https://developers.facebook.com/tools/explorer/?method=GET&path=fql%3Fq%3DSELECT%20pic_square%20FROM%20user%20WHERE%20uid%20IN%28SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me%28%29%29

Upvotes: 0

Related Questions