Summary: Simpleviewer recipe
Version: 1.0
Prerequisites: Flash Plugin installed, Simpleviewer's swf (included in the file attached)
Status: Beta
Maintainer: ? (original author: Gianpaolo Terranova)
Categories: Media, Markup
License: GNU GPL
Discussion: Simpleviewer-Talk?


The purpose of this recipe is to embed the easy flash gallery called Simpleviewer from Airtight interactive directly into a pmwiki page.


Older version:

This recipe provides a customizable block to generate the code needed for embedding the simple viewer swf file. It uses SWFObject, which is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file.

Given the path to the root path where the album (containing "images" and "thums" directory) is, 'mkgallery.php' generates the gallery.xml file on-the-fly. Editing the '.htaccess' file, it is also possible to get the resulting xml file whenever the user requests

The preparation of the album (images and thumbs) is out of the scope of this recipe. For such purpose, the script described in may come in handy.


The gallery works via a flash swf file, reading an XML file and some javascript. You can find the simpleviewer gallery at Airtight Interactive.


Download and extract the archive as shown below (or wherever you want, but then change the change the relevant paths in simpleviewer.php):



Then, add the following to local/config.php


To generate the gallery.xml on-the-fly, add the following line to your root .htaccess file:

RewriteRule ^(.*)/?gallery\.xml$ mkgallery.php?path=$1 [QSA,L]

You can also set the default value of the following variables.

Configuration Variables:

This module uses the following configuration variables:

default value $ScriptUrl."/wiki/cookbook/simpleviewer/viewer.swf"
default value $ScriptUrl."/wiki/cookbook/simpleviewer/swfobject.js"
default value $ScriptUrl."/mkgallery.php"
default value "#ffffff"
default value "bottom"
default value "6"
default value "2"


To add a simpleviewer gallery you should add a the following directive in your pages:

(:swfgallery <options> :)

The supported options are the following ( <option> => <default value> ):

$sg_params = array (

    'src' => $SGObjUrl,
    'width' => '540',
    'height' => '600',
    'bgcolor' => "$SGBGcolor",
    'preloaderColor' => '0x999999',
    'xmlDataPath' => ''


$xml_params = array (

  'path' => "",
  'url' => "",
  'maxImageWidth' => "",
  'maxImageHeight' => "",
  'textColor' => "",
  'frameColor' => "",
  'frameWidth' => "",
  'stagePadding' => "",
  'thumbnailColumns' => "$SGThumbCols",
  'thumbnailRows' => "$SGThumbRowss",
  'navPosition' => "$SGNavPos",
  'title' => "",
  'enableRightClickOpen' => "",
  'backgroundImagePath' => "",
  'imagePath' => "",
  'thumbPath' => "",
  // Set options for the buildgallery script by editing the values below
  // Set 'showDownloadLinks' to true if you want to show a 'Download Image' link as the c    aption to each image.
  'showDownloadLinks' => "",

  // Set 'sortImagesByDate' to false to sort by file name. Otherwise files are sorted by date modified.
  'sortImagesByDate' => "",

  // Set 'sortInReverseOrder' to false to sort images in forward order.
  'sortInReverseOrder' => "",

  // Set 'overwriteThumbnails' to true to re-create existing thumbnails each time the program runs. Useful if you are editing the images and keeping the same names.
  'overwriteThumbnails' => "",

  // set 'useCopyResized' to true if thumbnails are not being created.
  // This can be due to the imagecopyresampled function being disabled on some servers
  'useCopyResized' => ""


Release Notes

Version 1.0: first working version, works well on IE and Firefox

See Also



User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.