phpfacebookfacebook-graph-apifacebook-opengraph

Facebook: get user thumb img URL upon connecting to the app


How do I get user's profile photo URL upon connecting to my App? Not a big photo, but some sort of profile picture which would display only face photo of the user. (like the one is displayed next to the comment entry in Facebook comments)


Solution

  • Once connected to your app, all you need is to grab their user id. You can get this by calling https://graph.facebook.com/me (or parsing the access_token Facebook gave you). To get the users friends photos, you will want to access /me/friends and grab the id's. The image you are most likely looking for is this one, as it is their face and always a small squre:

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

    Zuck Square

    The other images will all be variable sizes across users:

    https://graph.facebook.com/4/picture?type=small

    Zuck small

    https://graph.facebook.com/4/picture?type=normal

    Zuck normal

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

    Zuck large