Simpleviewer

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?

Purpose

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

Solution

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 http://www.example.com/path/to/album/gallery.xml.

The preparation of the album (images and thumbs) is out of the scope of this recipe. For such purpose, the mkthumbs.sh script described in http://www.terranovanet.it/Blog/HowToPrepareAPhotoGallery may come in handy.

Description

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

Installation

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

root/

mkgallery.php
pmwiki/
cookbook/
simpleviewer.php
simpleviewer/
.htaccess
swfobject.js
viewer.swf

Then, add the following to local/config.php

'include_once("cookbook/simpleviewer.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:

$SGObjUrl
default value $ScriptUrl."/wiki/cookbook/simpleviewer/viewer.swf"
$SGJsUrl
default value $ScriptUrl."/wiki/cookbook/simpleviewer/swfobject.js"
$SGXmlUrl
default value $ScriptUrl."/mkgallery.php"
$SGBGcolor
default value "#ffffff"
$SGNavPos
default value "bottom"
$SGThumbCols
default value "6"
$SGThumbRows
default value "2"

Usage

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' => ""
  );

Demo

http://www.terranovanet.it/Gallery/Gallery

Release Notes

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

See Also

Contributors

Comments

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.