We used to have a very active photo gallery based on the opensource gallery software; however this seemed to suffer from a variety of archiving robots that caused the site to seize up regularly. To combat this, I’ve decided to move our photo system across to flickr and see if we can get some user driven content onto the site relating to events and meetings run by the Scheme. Our id is “portable antiquities” and you can access these photos directly under an “attribution” Creative Commons Licence. If you want to get an RSS feed of these, you can also do this.
The Scheme’s homepage now features a feed of images directly from the flickr site and updates automatically and uses the class wrapper provided by phpflickr to compile the images on screen. The code is below and also makes use of caching to speed up the rendering of the images.
[PHP]
enableCache(
“db”,
“mysql://userid:password@server/database”
);$i = 0;
{
// Find the NSID of the username inputted via the form
$person = $f->people_findByUsername(‘flickr username’);
// Get the friendly URL of the user’s photos
$photos_url = $f->urls_getUserPhotos($person['id']);
// Get the user’s first 15 public photos
$photos = $f->people_getPublicPhotos($person['id'], NULL, 15);
// Loop through the photos and output the HTML
foreach ((array)$photos['photo'] as $photo) {
echo ““;
echo “buildPhotoURL($photo, “Square”) . “>”;
echo ““;
$i++;
// If it reaches the third photo, insert a line break
if ($i % 3 == 0) {
echo “
\n”;
}
}
}
?>
[/php]
You can adapt the script quite easily to your own needs, or go for different flavours of output such as JSON – I’ve used that on another site. If you want to add photos to flickr that relate to the Scheme, perhaps use the tag “portable antiquities” and I’ll set up a feed of user driven content on the site. I’m thinking about setting up a page that draws in content from technorati, del.icio.us, digg, They work for you and various other sources that aggregates comments relating to the Scheme.