diff options
author | Greg Froese <greg.froese@gmail.com> | 2009-10-08 04:38:19 +0000 |
---|---|---|
committer | Greg Froese <greg.froese@gmail.com> | 2009-10-08 04:38:19 +0000 |
commit | 24f3f2f0d304254451c46a3b28a8e1f4678bc02f (patch) | |
tree | c95dc02130267e6c2d7053faf7546089c1c744b1 /lib/phpFlickr/example.php | |
parent | 6b00bdba17af611726eb950fb51758556694e80f (diff) | |
download | elgg-24f3f2f0d304254451c46a3b28a8e1f4678bc02f.tar.gz elgg-24f3f2f0d304254451c46a3b28a8e1f4678bc02f.tar.bz2 |
flickr integration
Diffstat (limited to 'lib/phpFlickr/example.php')
-rw-r--r-- | lib/phpFlickr/example.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/phpFlickr/example.php b/lib/phpFlickr/example.php new file mode 100644 index 000000000..8b409b425 --- /dev/null +++ b/lib/phpFlickr/example.php @@ -0,0 +1,30 @@ +<?php +/* Last updated with phpFlickr 1.3.2 + * + * This example file shows you how to call the 100 most recent public + * photos. It parses through them and prints out a link to each of them + * along with the owner's name. + * + * Most of the processing time in this file comes from the 100 calls to + * flickr.people.getInfo. Enabling caching will help a whole lot with + * this as there are many people who post multiple photos at once. + * + * Obviously, you'll want to replace the "<api key>" with one provided + * by Flickr: http://www.flickr.com/services/api/key.gne + */ + +require_once("phpFlickr.php"); +$f = new phpFlickr("<api key>"); + +$recent = $f->photos_getRecent(); + +foreach ($recent['photo'] as $photo) { + $owner = $f->people_getInfo($photo['owner']); + echo "<a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>"; + echo $photo['title']; + echo "</a> Owner: "; + echo "<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>"; + echo $owner['username']; + echo "</a><br>"; +} +?> |