Created
May 22, 2012 20:06
-
-
Save matths/2771311 to your computer and use it in GitHub Desktop.
grab user's facebook album cover pictures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// don't forget to set &oauth=1 in FB.init | |
// check for valid login, the easy way: | |
if (FB._authResponse != null) | |
FB.login(function(r) {}, {scope: 'user_photos'}) | |
FB.api('/me/albums', function(d) { | |
for (var i=0; i<d.data.length; i++) { | |
console.log(d.data[i].id, d.data[i].name, d.data[i].link); | |
// type: thumbnail, small, album | |
$('body').prepend('<img src="https://graph.facebook.com/'+d.data[i].id+'/picture?type=thumbnail&access_token='+FB._authResponse.accessToken+'">'); | |
} | |
}); | |
var albumId = 000000000; | |
FB.api('/'+albumId+'/photos/', function(d) { | |
for (var i=0; i<d.data.length; i++) { | |
console.log(d.data[i].id, d.data[i].source, d.data[i].picture); | |
$('body').prepend('<img src="'+d.data[i].picture+'">'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment