So I may often be late to the party, but I can drink fast enough to catch up. Judith Meskill has inspired me to photo blog. Thomas does it too, so I started using my Flickr account and the Flickr Feeds and built a quick little php script to display the Photo Blog on the left column of my blog.
<div style="width: 240px">
<? $feed=getFlickrFeed('52576524@N00'); ?>
<h3><?=$feed['title']?></h3>
<? foreach ($feed['items'] as $num => $photo) { ?>
<div style="margin: 5px; padding: 4px;">
<b><?=$photo['title']?></b><br />
<a href="<?=$photo['l_url']?>">
<img src="<?=$photo['t_url']?>" style="float:left; margin:3px;" border="0"></a>
<?=$photo['description_raw']?></div> 10: <div style="clear:both"></div>
<? }
function getFlickrFeed($id) {
$handle = @fopen("http://api.flickr.com/services/feeds/photos_public.gne?". 15: "id=$id&format=php_serial", "r");
if ($handle) {
while (!feof($handle)) {
$buffer .= fgets($handle, 4096);
}
fclose($handle);
}
return unserialize($buffer);
}
?>


Comments (-4)
Inappropriate or promotional comments may be removed.
Mike (5:58 PM on Thu Jun 7, 2007)
You know we have an RSS parser built into blogsmith that you could use, right? ;)
Craig (6:15 PM on Thu Jun 7, 2007)
Yep, I do and it would work great for lots of applications like this (and it caches), I wanted to show how it would work with simple php and I'm really psyched about the php_serial fead in Flickr.
Christoph recommend replacing the whole getFlickrFeed with
$feed=unserialize( file_get_contents("http://api.flickr.com/services/feeds/photos_public.gne?id=52576524@N00&format=php_serial"));
Which would work as well.