Flickr

Installation

Follow these steps to install this script on your wiki.

  1. Go to Service managmenent inside the Control Panel.
  2. Under Add Service, click Local and select type Extension.
  3. Enter a descriptive name and the SID: sid://mindtouch.com/2007/12/dekiscript
  4. Add "manifest" to the config section with value set to http://scripts.mindtouch.com/flickr.xml
  5. Add extra configuration values as listed below under Configuration (If Configuration is not listed below, ignore this step.)
  6. Click on add service.

Related Links: DekiScript service, Extension Overview, DekiScript Overview, Extension Demos.


Overview

This extension contains functions for embeding tagged pictures from Flickr. This script requires MindTouch Deki 1.8.3 or later.

Functions:

  1. flickr.badge
  2. flickr.slideshow

flickr.badge(tags) : xml

Embed Flicker badge.

Parameters:

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


flickr.slideshow(tags, width, height, 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)


Source Code

<extension>
  <title>MindTouch Flickr Extension</title>
  <label>Flickr</label>
  <copyright>Copyright (c) 2007, 2008 MindTouch, Inc.</copyright>
  <description>This extension contains functions for embeding tagged pictures from Flickr.</description>
  <uri.help>http://wiki.developer.mindtouch.com/MindTouch_Deki/Extensions/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
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.
Powered by MindTouch Deki Enterprise Edition v.8.08 RC2