Flickr Slideshows & Badges

Flickr Extension
Vendor
MindTouch
Type Script
Categories Images
Requires MindTouch Core 1.8.3 or later
Status Stable
License Free/Open Source
Manifest http://scripts.mindtouch.com/flickr.xml

 

Install Script
To add  this script to your site, enter the address of your MindTouch installation (ex: http://www.mindtouch.com) and click the Add Script button.  This will open your control panel and prepopulate the necessary values.  You will still need to manually add configuration settings if required.  Note that no changes are made to your site until you confirm the action in your control panel.
Your site address:     


Table of Contents

Description

This extension contains functions for embedding tagged pictures from Flickr.

See also How to add a script, Using the Extension Dialog, Learn about DekiScript, Extensions Directory.


Functions

flickr.badge(tags : str) : xml

Embed Flicker badge.

Parameters:

NameTypeDescription
tagsstrComma separated list of tags. (default: "mindtouch")


flickr.slideshow(tags : str, width : num, height : num, uri : uri) : xml

Embed Flickr slideshow.

Parameters:

NameTypeDescription
tagsstr(optional) Comma separated list of tags. (default: nil)
widthnum(optional) Slideshow width. (default: 450)
heightnum(optional) Slideshow height. (default: 400)
uriuri(optional) URI to user, set, or group page. (default: nil)


Script Source

<extension>
  <title>Flickr Extension</title>
  <label>Flickr</label>
  <copyright>Copyright (c) 2006-2009 MindTouch Inc.</copyright>
  <description>This extension contains functions for embedding tagged pictures from Flickr.</description>
  <uri.help>http://developer.mindtouch.com/App_Catalog/Flickr</uri.help>
  <uri.logo>http://scripts.mindtouch.com/logos/flickr-logo.png</uri.logo>
  <namespace>flickr</namespace>
  
  <function>
    <name>slideshow</name>
    <description>Embed Flickr slideshow.</description>
    <param name="tags" type="str" optional="true">Comma separated list of tags. (default: nil)</param>
    <param name="width" type="num" optional="true">Slideshow width. (default: 450)</param>
    <param name="height" type="num" optional="true">Slideshow height. (default: 400)</param>
    <param name="uri" type="uri" optional="true">URI to user, set, or group page. (default: nil)</param>
    <return>
      <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
        <body>
          <eval:block value="
                      var userId = nil;
                      var groupId = nil;
                      var setId = nil;
                      if(args.uri) {
                        /* uri points to a user account */
                        var u = uri.parse(args.uri);
                        if(#u.path >= 2) {
                          if(u.path[0] == 'photos') {
                            let userId = web.text(args.uri, './/_:form/_:input[@name=\'w\']/@value');
                            /* check if uri refers to a set of pictures */
                            if((#u.path >= 4) &amp;&amp; (u.path[2] == 'sets')) {
                              let setId = u.path[3];
                            }
                          } else {
                            if(u.path[0] == 'groups') {
                              /* uri points to a group account */
                              let groupId = web.text(args.uri, './/_:form/_:input[@name=\'w\']/@value');
                            }
                          }
                        }
                      }">
              <iframe
                eval:src="uri.build('http://www.flickr.com/slideShow/index.gne', _, { tags: args.tags, user_id: userId, group_id: groupId, set_id: setId })"
                eval:width="web.size(args.width ?? 450)"
                eval:height="web.size(args.height ?? 400)"
                marginwidth="0"
                marginheight="0"
                hspace="0"
                vspace="0"
                frameborder="0"
                scrolling="no"
            />
          </eval:block>
        </body>
      </html>
    </return>
  </function>

  <function>
    <name>badge</name>
    <description>Embed Flicker badge.</description>
    <param name="tags" type="str">Comma separated list of tags. (default: "mindtouch")</param>
    <return>
      <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
        <body>
          <iframe 
            eval:src="uri.build('http://www.flickr.com/apps/badge/badge_iframe.gne?zg_bg_color=FFFFFF&amp;zg_tag_mode=any', _, { zg_tags: args.tags })"
            width="113px"
            height="151px"
            marginwidth="0"
            marginheight="0"
            hspace="0"
            vspace="0"
            frameborder="0"
            scrolling="no"
          />
        </body>
      </html>
    </return>
  </function>
</extension>


Samples:

     Output

To embed a Flickr badge using images tagged with 'mindtouch':

{{ flickr.badge("mindtouch") }} 
./FlickrBadge.JPG

To Embed a Flickr slideshow showing images tagged with 'mindtouch':

{{ flickr.slideshow("mindtouch") }}
./FlickrSlideshow.JPG

To embed a 800 by 600 Flickr slideshow showing images tagged with 'mindtouch':

{{ flickr.slideshow("mindtouch", 800, 600) }}  
./BigFlickrSlideshow.JPG

To embed a Flickr slideshow for a group:

{{ flickr.slideshow{ uri: "http://flickr.com/photos/eamon/sets/72157594526998899/" } }}
./FlickrGroupSlideshow.JPG

Flickr slideshow for a particular user:

{{ flickr.slideshow{uri:"http://www.flickr.com/photos/roebot/"} }}
    

    

Slideshow of a particular user's particular tag:

{{ flickr.slideshow{ uri: "http://www.flickr.com/photos/roebot/", tags: "MindTouch" } }} 

    

    

    

Tag page (Edit tags)
Viewing 4 of 4 comments: view all
How can I embed a Flickr slideshow for the certain tag, sorted by interestingness? Is it possible?
Posted 01:23, 15 Feb 2008
Looking at the current set of parameters, the answer would be "no" you cannot sort by "interestingness"? Instead I would suggest modifying you tags to better pin point the images you want. Flickr results will vary, but for the most part I am pleased with the results. I use the feature on almost every page of one of my Deki Wiki sites: http://youknowyouarefrom.wik.is, where I have slide shows for various countries, states and cities and I just use the page.title parameter for most pages within a template I created. Sometimes I have to edit the tags. I also take full advantage of the Google extensions.
Posted 14:07, 15 Feb 2008
{{ flickr.slideshow("tag1,tag2") }} is working, but why is this not working with the option badge?
{{ flickr.badge("tag1,tag2") }}
Posted 02:09, 1 Mar 2008
Can you have multiple tags for a slideshow that will search as an & vs or?

For example, {{ flickr.slideshow("tag1,tag2") }} this appears to default to any images with tag1 or tag2. I would like only images with both tag1&tag2?
Posted 21:58, 27 Mar 2008
Viewing 4 of 4 comments: view all
You must login to post a comment.