Skip to content

Instantly share code, notes, and snippets.

@manfromanotherland
Created May 13, 2015 20:17
Show Gist options
  • Select an option

  • Save manfromanotherland/89d0e81b579bc7d09c08 to your computer and use it in GitHub Desktop.

Select an option

Save manfromanotherland/89d0e81b579bc7d09c08 to your computer and use it in GitHub Desktop.
JS: Embed Facebook last image #snippet
<div id="facefeed">
<!-- images will appear here -->
</div>
(function (gallery_id) {
var faceFeed = $('#facefeed');
// images
$.getJSON('//graph.facebook.com/' + gallery_id + '/photos?callback=?', function(json, status, xhr) {
var imgs = json.data;
for (var i = 0, l = 5; i < l; i++) {
$('<a href="' + imgs[i].link + '" target="_blank" title="' + imgs[i].name + '">' + '<img src="' + imgs[i].images[3].source + '" width="' + imgs[i].width + '" height="' + imgs[i].height + '">' + '</a>').appendTo(faceFeed);
}
});
})('0000000'); // put the gallery ID here (usually Timeline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment