user1653509
user1653509

Reputation: 153

facebook registration plugin - get either large profile pic or username or userid?

i am using facebook registration plugin. I can get the profile pic of the user by knowing either his facebook username or userid (accesstoken not required for pic). I can get userid or username by getting the access token etc. But , i cant get the username or userid from accesstoken here. So, is there any way i can get the username or userid or large profile pic from registration plugin?

Thanks

Upvotes: 0

Views: 447

Answers (2)

jk.
jk.

Reputation: 14435

I couldn't get the accepted answer to work for me but this did:

You can get specific sizes of the profile pic as well.

FB.api("/me/picture?width=180&height=180",  function(response) {

        console.log(response.data.url);

});  

See the Facebook documentation to see what different picture sizes you can get.

And a complete demo with login at: Get Facebook Profile Picture with Javascript SDK

Upvotes: 2

Prynz
Prynz

Reputation: 551

Using the Javascript SDK, you can use Javascript to get the profile picture by doing this:

FB.api("/me", {fields: "id,name,picture"}, function(response){
    FB.api(
        {
            method: 'fql.query',
            query: 'SELECT src_big FROM photo WHERE aid IN ( SELECT aid FROM album WHERE owner="' + response.id + '" AND name = "Profile Pictures")'
        },
        function(data) {
            alert( data[0].src_big ); // this will alert the URL of the profile picture (stored in data[0].src_big), replace the alert with some useful operation
        }
    );
});

See similar post: Facebook Javascript SDK - Query Profile Picture

Hope this helps.

Upvotes: 0

Related Questions