Mini Blogging Meskill Style

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.

Reply
Mike (5:58 PM on Thu Jun 7, 2007)

You know we have an RSS parser built into blogsmith that you could use, right? ;)

Reply
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.

Add a comment Cancel & reply to article ›

Inappropriate or promotional comments may be removed. To create a clickable link, simply type the URL (including http://) and we will make a link for you. Line breaks and paragraphs are automatically converted — no need to use <p> or <br> tags, but if you're into that kind of thing, you can use any of the following tags: b, i, strong, em, a (href only), p and br.

Click one of the three commenter types below. Member comments are added immediately once you confirm your email address. Anonymous comments are moderated by our editorial staff.

Email Me
  
Comment Preview
Avatar
Your Name (11:13 PM on Fri Oct 10, 2008)

Preview your comment here.