Getting the “real” Facebook profile picture URL from graph API

后端 未结 12 2043
说谎
说谎 2020-12-12 15:25

Facebook graph API tells me I can get a profile picture of a user using

http://graph.facebook.com/517267866/picture?type=large

which works fine. However, whe

12条回答
  •  悲哀的现实
    2020-12-12 16:09

    I realize this is late, but there is another way to obtain the URL of the profile image.

    To your original url, you can add the parameter redirect=false to obtain the actual URL of the image you'd normally be redirected to.

    So, the new request would look like http://graph.facebook.com/517267866/picture?type=large&redirect=false. This will return a JSON object containing the URL of the picture and a boolean is_silhouette (true if the picture is the default Facebook picture).

    The picture will be of the size you specified, as well. You can test this additionally by adding dimensions: http://graph.facebook.com/517267866/picture?type=large&redirect=false&width=400&height=400

提交回复
热议问题