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
Sponsored Links





I am getting this kind of error.
—–
Severity: User Warning
Message: /home13/xxx/www/system/application/cache/flickr-rss-cache/509a32df9adcdc21726cd5eadf499d56.spc is not writeable
Filename: libraries/Simplepie.php
Line Number: 1780
—–
Of course, I created cache folder, flickr-rss-cache folder, and also set their permission to be 777.
I searched through web, and there seem to be other people who are having a same problem with me.
What would be a problem???
Do I have to configure my Flickr-account in any way?
I tried with Elliot’s profile and it works great. But as soon as i change to my own user ID I cant get any photos. No errors or so, just an empty array.
Any ideas?
[...] Flickr [...]
It is working with Elloit Account but it is not working with my account.
What is esssential variable we need to set in Config variable?
@the problem guy
I had the same problem but got it working. Just made a cache directory like this: /system/application/cache/flickr-rss-cache. And then I set the permissions to 777 for both cache and flickr-rss-cache. Once I did that the error went away and it all worked.
@Pajp and gouse:
I too had the problem of it not returning any of my pics. But then I looked at the config array that you pass to $this->flickr->config and noticed that the tags index had a value of ‘london’. And since none of my pics had the tag of london, none would show up . That should fix your problems =D
Hi,
thanks for this great library.
I had to make some adjustments to make it work with “use_cache=true”.
In the config array:
img_cache_path -> cache_path
img_cache_url -> cache_url
…$this->config->item(’base_url’).’application/cache/flickr-image-cache… ->
…$this->config->item(’base_url’).’system/application/cache/flickr-image-cache…
Cheers