Photo Galleries

Act lets you easily create photo galleries in your own static pages by grabbing tagged photographs from Flickr.

Configure the tags

In your conference's act.ini configuration file, specify the tag or tags used by your conference.

  tags = foo,bar,baz

Creating a gallery

In any template or static HTML page, use the flickr_get function to retrieve photographs. This function returns an array, each element is a hash that provides a set of URLs for each photograph.

  photo_page    this photo's Flickr web page
  owner_page    this photo owner's Flickr web page
  smallsquare   small square 75x75
  thumbnail     thumbnail, 100 on longest side
  small         small, 240 on longest side
  medium        medium, 500 on longest side

flickr_get returns a shuffled list of all photographs. An optional argument may be provided to limit the number of returned photographs. This examples displays 42 randomly selected photographs in "smallsquare" format, linking each picture to its Flickr web page.

  [% WRAPPER ui title="Photo Gallery" %]
    [% photos = flickr_get(42); FOREACH p = photos %]
      <a href="[% p.photo_page %]"><img src="[% p.smallsquare %]" /></a>
    [% END %]
  [% END %]

Animation can be added using a bit of client-side JavaScript code. Here's a simple slide show:

  [% WRAPPER ui title="Photo Gallery" %]
    <script language="JavaScript">
    if (window.act) {
        $(function() {
            var photos = [
              [% photos = flickr_get(); FOREACH p = photos %]
                '[% p.medium %]'[% ',' UNLESS loop.last %]
              [% END %]
            function newpic()
                var i = Math.floor(Math.random() * photos.length);
                $("#flickrimage").attr('src', photos[i]);
                setTimeout(newpic, 5000);
    [% IF photos.size %]
      <img id="flickrimage" src="" />
    [% END %]
  [% END %]

Act::Manual::Organizer::CurrentEvents shows how to create a full screen window displaying current talks and events and a photo slideshow.


Philippe Bruhat, Éric Cholet


This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.