Friday, 02 August 2013 23:27

how to get facebook profile or page image using Graph api

Written by 
Rate this item
(0 votes)
Nowadays soial media like facebook is in almost
all websites.
It will be nice if you show your site user's profile image
as that user's profile image of facebook.

Following function shows how to get someone's facebook
profile picture usign Graph api url.It is also useful to get
any facebook page image too -

function getAvatarURL(id){
var avatarURL;
avatarURL = 'https://graph.facebook.com/'+id+'/picture?type=square'; }
return avatarURL;
}

here you need to supply profile/page id in the above function, which
in turn returs the image url.You can get id of profile/page opening
that profile/page in facebook and viewing page source code.Use google.com
to know how you can get it.

If you like that post don't forget to like & share.
Read 3196 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.