• Client login
  • Work for us

All the latest from the team...

Monday, 23 February 2009

Connecting with the Flickr API through PHP

Here at Code Required we've been playing with a lot of the Social networking apps over the months... Years and have started to think about the potential of putting them all together and seeing what comes out the other end...

We'll be posting samples of what you can do here and would love you guys to post your samples too!

Anyway to kick off here's how to get a list of your photos from Flickr using the phpFlickr class:

$f = new phpFlickr("YOUR_API_KEY");
$i = 0;

// Find the NSID of the username inputted via the form
$person = $f->people_findByUsername('YOUR_USER_NAME');

// Get the friendly URL of the user's photos
$photos_url = $f->urls_getUserPhotos($person['id']);

// Get the user's first 36 public photos
$photos = $f->people_getPublicPhotos($person['id'], NULL, 1, 8);

// Loop through the photos and output the html
foreach ((array)$photos['photos']['photo'] as $photo) {
echo "
<a href='".$f->buildPhotoURL($photo)."'>";
echo "<img width='43' style='margin:4px' border='0' alt='$photo[title]' ". //
>
"src='" . $f->buildPhotoURL($photo, "Square") . "' />";
echo "</a
>";
$i++;
// If it reaches the sixth photo, insert a line break
if ($i % 4 == 0) {
echo "
";
}
}


You can get your Flickr API key here and explore more cool stuff in the Flickr API Docs

Have fun!

Labels: , , , ,

Busy busy busy & our adventures with Google

Wow things have been hectic for me over at Code Required recently so apologies for the lack of posts since early December - ouch!

We've been doing some really cool stuff with the Google API recently and have spent several hours geeking out with the guys down at Google HQ in London - which has been great fun and a steep learnign curve for us!

We'll be publishing some articles on Google Apps, Google Sites and the Enterprise Search application in the next few months so watch this space! We must admit we're very very excited about the Google Sites stuff so suggest you all check it out and post your samples back here as we'd love to see what everyone is doing!

Anyway - we're still alive so watch this space!

Labels: , , , ,

RSS feed ATOM feed Add to Technorati Favorites View Jon Harvey's profile on LinkedIn