Simple way to get recent images for some Instagram's profile:
1) Create new app for Instagram access
http://instagram.com/developer/clients/register/ (requried)
2) Create new snippet with name
InstaRecentMedia:
<?php
$json = file_get_contents('https://api.instagram.com/v1/users/'. $user_id .'/media/recent/?client_id=' . $client_id . '&count=' . $count);
$decode = json_decode($json, true);
$output = '';
foreach ($decode['data'] as $post) {
$output .= $modx->getChunk($tpl,
array(
'link' => $post['link']
,'image' => $post['images']['standard_resolution']['url']
,'comments' => $post['comments']['count']
,'likes' => $post['likes']['count']
)
);
}
return $output;
3) Create new chunk with name
tpl.InstaRecentMedia (I use Twitter Bootstrap):
<div class="col-md-12 col-sm-6">
<a href="[[+link]]" class="insta-post" target="_blank">
<img src="[[+image]]" alt="" class="img-responsive">
<div class="btn-group btn-group-justified">
<div class="btn-group">
<button class="btn btn-default comments" title="Комментарии"><i class="fa fa-comments fa-fw"></i> [[+comments]]</button>
</div>
<div class="btn-group">
<button class="btn btn-default likes" title="Отметки «Мне нравится»"><i class="fa fa-heart fa-fw"></i> [[+likes]]</button>
</div>
</div>
</a>
</div>
4) Insert in your document some like this:
[[!InstaRecentMedia?
&user_id=`_USER ID WHICH WE WANT TO PARSE_`
&client_id=`_YOUR CLIENT ID FROM INSTAGRAM APP MANAGER_`
&count=`_HOW MANY ARTICLE WE WANT TO GET_`
&tpl=`tpl.InstaRecentMedia`
]]
NB! USER ID is not username. You can get this here for example:
http://jelled.com/instagram/lookup-user-id