Get user profile picture by Id

后端 未结 15 2322
闹比i
闹比i 2020-11-27 10:08

I\'m now working on a web application which is mostly based of facebook graph api. I hold some data about users - actually , the possible public data available - such as nam

相关标签:
15条回答
  • 2020-11-27 10:46

    Simply Follow as below URL

    https://graph.facebook.com/facebook_user_id/picture?type=square

    type may be normal,small,medium,large. Or square (f you want to get square picture, the square size is limited to 50x50).

    0 讨论(0)
  • 2020-11-27 10:49

    Use url as:https://graph.facebook.com/user_id/picture?type=square in src of img tag. type may be small,large.

    0 讨论(0)
  • 2020-11-27 10:50

    As per the current latest Facebook API version 3.2, For users you can use this generic method for getting profile picture is https://graph.facebook.com/v3.2/{user-id}/picture?type=square you can visit documentation for user picture here. The possible values for type parameter in URL can be small, normal, album, large, square

    For Groups and Pages, the profile picture is not available directly. You have to get them using access token. For Groups you have to use User Access Token and for Pages you can use both User Access Token and Page Access Token.

    You can get Group's or Page's Profile Picture using the generic URL: https://graph.facebook.com/v3.2/{user-id}/picture?access_token={access-token}&type=square

    I hope this is helpful for people who are looking for Page or Group Profile picture.

    0 讨论(0)
  • 2020-11-27 10:52

    You can use AngularJs for this, Its two -way data binding feature will get solution with minimum effort and less code.

    <div> <input type="text" name="" ng-model="fbid"><br/> <img src="https://graph.facebook.com/{{fbid}}/picture?type=normal"> </div>

    I hope this answers your query.Note: You can use other library as well.

    0 讨论(0)
  • 2020-11-27 10:54

    To get largest size of the image

    https://graph.facebook.com/{userID}?fields=picture.width(720).height(720) 
    

    or anything else you need as size. Based on experience, type=large is not the largest result you can obtain.

    0 讨论(0)
  • 2020-11-27 10:57

    You can use following urls to obtain different sizes of profile images. Please make sure to add Facebook id to url.

    Large size photo https://graph.facebook.com/{facebookId}/picture?type=large

    Medium size photo https://graph.facebook.com/{facebookId}/picture?type=normal

    Small size photo https://graph.facebook.com/{facebookId}/picture?type=small

    Square photo https://graph.facebook.com/{facebookId}/picture?type=square

    0 讨论(0)
提交回复
热议问题