video-poster

Ever wanted a function to display your Flickr photos anywhere you want? This quick plugin will give you exactly that: a simple function that you can place anywhere in your template that you want to display a list of photos from a Flickr account.


[box style=”notice”]This is a quick tip. Check out more Quick Tips[/box]

1
2
3
4
5
6
7
8
9
10
11
/*
* Display a user's flickr photos
*
* @param - string - $user - The ID of the user to display
* @oaram - string - $size - The image size to show. s,m,t are valid options
* @param - string - $display - either "latest" or "random"
* @param - integer - $count - the number of photos to show. Between 1 and 10
*/
function simple_flickr_display($user = '', $size = 's', $display = 'latest', $count = 10) {
	echo '<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=' . $count . '&amp;display=' . $display .'&amp;size=' . $size .'&amp;layout=y&amp;source=user&amp;user=' . $user . '"></script>';
}

To display the photo stream, simply place the function in one of your templates like this:

1
simple_flickr_display($user = 'yourUserID');

Or if you want to customize it a little more, you can change the default parameters:

1
simple_flickr_display($user = 'yourUserID', $size = 'm', $display = 'random', $count = 5);

You can easily find your user ID by going to your public photo stream and looking at the URL. For example, my public stream is at: http://www.flickr.com/photos/59968725@N03/, and my user ID is 59968725@N03.

I hope you find this useful, and keep your eyes open because I will be releasing a greatly enhanced version of this plugin that includes a widget sometime very soon.

Download the function as a complete plugin below.

Download
  1. Wilbur Taute

    I’d love to see a demo of this plugin in action :)

Your email address will not be published. Required fields are marked *

Error: Please enter a valid email address

Error: Invalid email