Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display single latest instagram photo on your website

I am looking all over the web and can't believe I can't find an answer to my question. I would like to display the latest single instagram photo on my website. simple as that.

No gallery, no fancybox, no slideshow etc etc

I found this useful link: http://www.blueprintinteractive.com/blog/how-instagram-api-fancybox-simplified

it's actually working but it doesn't give an option of how many images you would like to display and I would like only one latest instagram image.

anyone have an idea?

Thanks

like image 661
gil hamer Avatar asked Apr 29 '14 10:04

gil hamer


2 Answers

You can break foreach after showing first image like below:

foreach ($result->data as $post) {
  // Do something with this data.
  break; // for one result only
}

Or add &count=1 at end of url as below

https://api.instagram.com/v1/users/ID-GOES-HERE/media/recent/?access_token=TOKEN-GOES-HERE&count=1
like image 162
Manoj Yadav Avatar answered Sep 30 '22 16:09

Manoj Yadav


The answer is right here: http://instagram.com/developer/endpoints/users/#get_users_media_recent_with_client_id

Count option for number of media !

like image 22
Superdrac Avatar answered Sep 30 '22 16:09

Superdrac