Professional Freelance Web Developer
CodeIgniter Activist, Caffeine Junkie

Elliot Haughin

Flickr CodeIgniter Library

On my blog, here… I have a little grid of my latest flickr pictures in the footer.
It’s quite nice, I like people to see what I’ve been up to recently in the ‘real world’.

That’s why I decided to build a library to do this in CodeIgniter!

The basic library parses an RSS feed of photos according to your options, and then returns the image data.

So… this is how you use it in your controller:

$this->load->library('flickr');
 
$config = array(
	'type'				=> 'user',
	'user'				=> '56471355@N00',
	'num_items'		=> 10,
	'rss_cache_path'		=> APPPATH.'cache/flickr-rss-cache',
	'cache_time'		=> 3600,
	'img_cache_path'		=> APPPATH.'cache/flickr-image-cache',
	'img_cache_url'		=> $this->config->item('base_url').'application/cache/flickr-image-cache',
	'use_cache'			=> false,
	'image_size'		=> 'square',
	'tags'				=> 'london'
);
 
$this->flickr->init($config);
 
$data['photos'] = $this->flickr->get_photos();

Note: Your ‘user’ must be your flickr id, you can get it from idgettr

In you view files, display your images like so:

<?php foreach ($photos as $photo):?>
<img src="<?=$photo['image_url']?>" />
<?php endforeach; ?>

Download Flickr CodeIgniter Library

REQUIRES SIMPLEPIE CODEIGNITER LIBRARY

Version: 1.0

Boring Stuff

Design © copyright Elliot Haughin 2009

Content published here are copyright their respective owners.

You cannot copy content from this site, either in English or translated to another language.

Keep Subscribed

Theres lots of ways for you to keep up with me on the web.

Please Note

Information given out on this blog should only be used as a guideline. I hold no liability for any code I write.

Always consult a professional before acting on this guidance.