Created
February 29, 2012 09:43
-
-
Save hasantayyar/1939489 to your computer and use it in GitHub Desktop.
Get Facebook Albums and Album Photos
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
function getAlbumPhotos(albumid){ | |
FB.api("/"+albumid+"/photos",function(response){ | |
var photos = response["data"]; | |
var html = "count "+photos.length; | |
for(var i=0;i<photos.length;i++) { | |
var images = photos[i]["images"]; | |
html+= "Photo "+(v+1); | |
html+= '<img src="'+images[(images.length-1)]["source"]+'" />'; | |
var tmp = ""; | |
for(var j = 0 ;j<images.length;j++) { | |
tmp+= '<a href="'+images[j]["source"]+'"> size : '+images[j]["width"]+"X"+images[j]["height"]+'</a><br />'; | |
} | |
html+=temp+"<hr />"; | |
} | |
document.getElementById("photos").innerHTML = html; | |
}); | |
} | |
function getAlbums(){ | |
document.getElementById("albums").innerHTML="yukleniyor..."; | |
FB.api('/me/albums', function(resp) { | |
var html="<ul>"; | |
for (var i=0, l=resp.data.length; i<l; i++){ | |
var album = resp.data[i]; | |
html+= '<li><a href="#" onclick="getAlbumPhotos(\''+album.id+'\')">get photos</a> <a href="'+album.link+'">'+album.name+'</a><li>'; | |
} | |
html+="</ul>"; | |
document.getElementById("albums").innerHTML=html; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment