Stephen Reese

I was thinking about how to retrieve photos from Facebook photo gallery’s and came across a number of solutions. Most of the solutions were for blog or CMS and furthermore required caching your credentials in a database along with a few other hoops in order to access your albums and display them on a third party site. I thought this was a bit odd as if you want to share photos on your blog or site you should be able to just make the album public and use Facebooks API to connect since they are going to be public at that point. After poking around this ended up being much easier than expected and it works with Facebook Fan Pages which is where I think this would be most useful.

  1. You need to create a Facebook application account which will provide you with your appId and secret.
  2. Next you need to get the PHP SDK from GitHub. All you need is the facebook.php page but feel free to grab the ZIP and explore. There is an example to experiment with.
  3. Lastly you can use the code provided on Google Code as a basic start to implementing a photo gallery on your site.

The code displays thumbnails, source images along with name’s (caption’s) below each image that have them and finally the source which you can use to derive other goodies that you might want to use in you gallery. Some examples are different size thumbnails, id, comments, etc.

*Note that the script does not parse double quotes in photo captions well at this point.

If you notice any issues, room for improvement or features feel free to leave a comment or post an issue over at the Google Code page.


comments powered by Disqus