This should be fairly common but somehow I cannot get it to work. What I would like to do is the get album pictures from facebook. I am implementing this on a website.
I can get the albums using this code:
function getAlbumPhotos(){
FB.api('/me/albums', function(resp) {
//Log.info('Albums', resp);
var ul = document.getElementById('albums');
for (var i=0, l=resp.data.length; i<l; i++){
var
album = resp.data[i],
li = document.createElement('li'),
a = document.createElement('a');
a.innerHTML = album.name;
a.href = album.link;
li.appendChild(a);
ul.appendChild(li);
}
});
};
the resp returns a data array which contains links to the photo albums BUT I would like the image sources for each album and I don't see anything I can use in the resp data. The data object contains a link to the album but not individual images.
According to facebook documentation, photos are "connections" to albums. I am not sure what means but their doc shows that you can get individual photos.
From this link:
[http://developers.facebook.com/docs/reference/api/album/][1]
it shows the json(?) returns link, id, name, etc...which I am able to get. However, at the bottom of that page are "connections" to album which includes photos, comments, pictures. When I click on photos, it shows the JSON data structure including the img src. Question is, how do I get that? It seems so straightforward but I can't get it to work.
I tried
FB.api('/me/photos',function(resp) ...
and
FB.api('/me/photo',function(resp) ...
photos return nothing while photo returns undefine.
Code samples will be greatly appreciated.