Created
January 12, 2016 06:28
-
-
Save anehkumar/352be6ddb20a943f1e19 to your computer and use it in GitHub Desktop.
Load images from Instagram - http://trinitytuts.com/instagram/
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
<?php | |
$handle = curl_init("https://api.instagram.com/v1/users/self/media/recent/?access_token=<your_access_tocken>"); | |
//curl_setopt($handle, CURLOPT_GET, true); | |
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); | |
$output = curl_exec($handle); | |
curl_close($handle); | |
?> | |
<html> | |
<head> | |
<title>My Instagram</title> | |
<!-- Add your angular here //--> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> | |
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> | |
<!-- Optional theme --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous"> | |
</head> | |
<body> | |
<div class="container"> | |
<div ng-app="instagram" ng-controller="getData"> | |
<div ng-repeat="img in data.data" ng-if="$index % 3 == 0" class="row"> | |
<div class="col-xs-4"><a class="thumbnail" href="#"><img src="{{data.data[$index].images.low_resolution.url}}"></a></div> | |
<div class="col-xs-4"><a class="thumbnail" href="#"><img src="{{data.data[$index + 1].images.low_resolution.url}}"></a></div> | |
<div class="col-xs-4"><a class="thumbnail" href="#"><img src="{{data.data[$index + 2].images.low_resolution.url}}"></a></div> | |
</div> | |
</div> | |
</div> | |
<script> | |
var app = angular.module("instagram" , []); | |
app.controller('getData' , function($scope, $http){ | |
$scope.data = <?=$output ?>; | |
}); | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment