Created
September 10, 2015 02:58
-
-
Save sanjaybhowmick/17dfaa5cba14400cb809 to your computer and use it in GitHub Desktop.
instagram image feed on your website
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
<div class="instram-container"> | |
<?php | |
$user_id = "xxxxxxxxxx"; //userid | |
$num_to_display = "8"; //instagram limits to max 20, but you can do less for your layout. | |
$access_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // access token | |
?> | |
<div class="instagram-block"></div> | |
<script type="text/javascript"> | |
$(function() { | |
$.ajax({ | |
type: "GET", | |
dataType: "jsonp", | |
cache: false, | |
url: "https://api.instagram.com/v1/users/<?=$user_id?>/media/recent/?access_token=<?=$access_token?>", | |
success: function(data) { | |
for (var i = 0; i < <?=$num_to_display?>; i++) { | |
$(".instagram-block").append("<ul><li><a target='_blank' href='" + data.data[i].link +"'><img height='227' width='242' class='instagram-image' src='" + data.data[i].images.low_resolution.url +"' /></a></li></ul>");} | |
} | |
});}); | |
</script> | |
<div class="clear"></div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment