Posts tagged "web"

  • April 24, 2012

    I’ve been looking for a good way to display my Instagram photos on my blog — some perfect storm of a solution that offers me control & flexibility, yet doesn’t require me to authorize a 3rd party to access my data. Since Instagram doesn’t offer their own public feeds (unlike Twitter, Flickr, etc), there aren’t many out-of-the-box solutions While sites like Listagram, Statigram, Instafeed, and Instagrid do a great job of showing other people my feed, they’re not designed to allow me to use that content on my own site.

    Thanks to a little Node.js code running on Heroku, I was able to build a little public feed of my Instagram photos. Basically, this Express app uses my Instagram API credentials to pull my recent images and presents the data via JSON. It leverages the instagram-node-lib project, too, which makes communicating w/ the Instagram API from Node a snap. I also threw in some Redis (Heroku makes this so trivial) to do some basic caching, to improve load times as well as reduce the Instagram API calls. Sprinkle in some front-end jQuery and a little CSS to make it all pretty, and you’ve got my brand new Instagram page. Not too shabby if I do say so myself! Be sure to scroll down and click on the “Gimme more photos…” button, too.

    Here’s the complete server-side code, if anyone is interested:

    And on the client-side, here is my jQuery, which handles the AJAX call as well as the animations:

    Apologies for any mistakes or smelliness — I don’t write a lot of JavaScript… But considering how quick and painless this was, I might just start! In any case, I hope this is useful for someone out there. Definitely let me know if you have any questions, or if you run into any issues with my new page.