Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a facebook profile picture from an email address

I'm trying to get a user's facebook profile picture based on their email address. Effectively, I want to offer my users the option between using Gravatar for their image, or Facebook. However, the only way I know of to get a user's facebook image is via:

http://graph.facebook.com/[FBOOK USERNAME]/picture?type=large

Since the usernames may vary between facebook and my site, I would like to do this via email address rather than username. How do I query for someone's facebook profile picture via email address?

like image 374
Mala Avatar asked Jun 28 '10 03:06

Mala


1 Answers

I see this question has a couple of years already but the same search approach can be taken using the Graph API:

GET https://graph.facebook.com/search?q={EMAIL}&type=user

You can try this on the Graph API Explorer. You don't get the profile picture directly but you get the user id which you can easily use to get the public profile picture.

https://graph.facebook.com/{UID}/picture

like image 174
urraka Avatar answered Oct 13 '22 00:10

urraka