DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:sviewer

SimpleViewer Plugin

Compatible with DokuWiki

2012-01-25 "Angua" 2010-11-07a "Anteater"

plugin Display Airtight Simpleviewer

Last updated on
2011-04-15
Provides
Syntax
Repository
Source
Requires
cache

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to autoviewer, gallery, gallery2, slideshow

Tagged with flash, gallery, images, slideshow

Installation

:!: External requirements: This plugin requires the following additional components that must be installed separately:

  • cache (Used for xml generation for simpleviewer)

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Installation Fix

:!: This plugin actually can be made working with Angua. It is a beautiful alternative to the gallery-plugin. Gallery currently has problems within Angua. It kind of works but it hangs up my browser when using keyboard-shortcuts in lightbox-mode to browse through the pictures. May be due to the switch of the java-script library. But Simple Viewer can be an even better alternative, depending on the context. Harald RongeHarald
Harald

2012/09/10 08:37

Instructions

  1. Install cache as described
  2. Install the Simple Viewer plugin with the plugin manager. It will install as “TTy32-sviewer-68eac18”, rename this folder in “/lib/plugins” to “sviewer” with FTP
  3. Within /lib/plugins/sviewer create a new sub-directory /lib/plugins/sviewer/simpleviewer
  4. get the viewer here http://www.simpleviewer.net/downloads/simpleviewer.zip and unpack on your local computer.
  5. copy simpleviewer.js, swfobject.js and simpleviewer.swf to /lib/plugins/sviewer/simpleviewer

Voilá!

Addendum

All directories mentioned here may change in the future, so if anybody notices this please change this description accordingly so it stays valid! If you prefer other locations in your plugin-folder change

  $this->swfLoc      = DOKU_BASE.'lib/plugins/sviewer/simpleviewer/simpleviewer.swf';
  $this->swfJsPath   = DOKU_BASE.'lib/plugins/sviewer/simpleviewer/simpleviewer.js';
  

in /lib/plugins/sviewer/syntax.php to your liking.

Examples/Usage

See the plugin in action here. FIXME Broken!

This plugin takes input images from a given namespace or a list of given images. It then generates a XML file which the simpleviewer SWF uses to show the gallery.

Almost all simpleviewer attributes can be defined for a gallery. If you do not specify these, then default values are taken from the Configuration Page.

The plugin in its most simplest form (use root namespace):

<sviewer>
{{:}}
</sviewer>

Custom simpleviewer attributes:

<sviewer 900 700 left modern A165FF 000000 30 bottom 2 1 true false 800 600 1 "Test Gallery">
{{:image1.jpg}}
{{:image2.jpg}}
</sviewer>

Syntax

<sviewer width height align galleryStyle textColor frameColor frameWidth thumbPosition thumbColumns thumbRows showOpenButton showFullscreenButton maxImageWidth maxImageHeight captionMode "Title">
{{namespace or images}}
</sviewer>

Attributes explained (also written in the configuration page):

Attribute Explaination
width SimpleViewer width
height SimpleViewer height
align SimpleViewer alignment (LEFT/RIGHT/NOALIGN)
galleryStyle Gallery Style (MODERN/COMPACT/CLASSIC)
textColor Color of title and caption text
frameColor Color of image frame, thumbnail frame, image navigation arrows and thumb navigation arrows
frameWidth Width of image frame
thumbPosition Position of thumbnails relative to main image (TOP/BOTTOM/RIGHT/LEFT/NONE)
thumbColumns Number of thumbnail columns
thumbRows Number of thumbnail rows
showOpenButton Whether to show “Open Image in New Window” button and right-click menu option (TRUE/FALSE)
showFullscreenButton Whether to show “Go Fullscreen” button and right-click menu option (TRUE/FALSE)
maxImageWidth Width of the widest image in the gallery. Used to determine the best layout for your gallery
maxImageHeight Height of tallest image in the gallery. Used to determine the best layout for your gallery
captionMode Captionmode, 0=No caption, 1=Filename as caption, 2=Filename as caption without extension
title SimpleViewer title

Development

The original plugin was made by Ikuo Obataya (see his AutoViewer plugin here). Thanks for your effort Ikuo!

I modified his plugin to work with SimpleViewer.

Syntax.php modifications

  • SWFobject javascript removed, used <object> and <embed> tags instead.
  • Modified RegEx to take additional attributes.
  • Modified $xml render to work with simpleviewer.
  • Modified default.php, metadata.php and settings.php accordingly.
  • Thumbnails are not generated, the original images are used instead.

Change Log

  • 2011-04-15
    • Initial release
  • 2011-04-18
    • RegEx fix for lowercase and uppercase attributes
    • Added feature for caption mode

Known Bugs and Issues

  • If you have issues regarding caching for the xml, add this to the top of your dokuwiki page:
    ~~NOCACHE~~
  • :!: Installation: please install the cache plugin first, otherwise you constantly get the message “sviewer plugin requires cache plugin.”. I will fix this soon.
  • Attributes within the sviewer tags have to be lowercase otherwise the default attributes are taken. I will fix this soon. Fixed.

ToDo/Wish List

  • Option to configure image captions via syntax (now the caption is always set to the namespace the image is located in). Added feature.
  • Add functionality to omit certain parameters (and thus taking default values)

FAQ

  • It is recommended to add an option to let show/hide “simple viewer” logo (link) at the bottom of page! I think the support link is enough to be displayed on local menu (right click ) — atronoushatronoush

    2011/06/18 08:37
    • Hi atronoush, unfortunately this is not possible for the free version of simpleviewer, you have to purchase simpleviewer pro. Or do you mean to add this option for a simpleviewer pro installation?

Discussion

If you encounter any problems post them here in the Discussion heading please, or contact me, i will respond as soon as possible :)

OK. Question 1 :-): The gallery plugin has a possibility to go to the full sized picture. sviewer is nicer to look at, but I do not find any way to get the original image. Its name is written in the lower left part of the box, but it isn't a link, and there's no link or action in the right-click menu of sviewer. I checked that $conf['showOpenButton'] = $conf['showFullscreenButton']= 1, so I'd expect to have a way to get to the full sized picture. — Werner FlammeWerner Flamme
werner.flamme

2012/09/10 14:27


Looks good, Install was without problems, Thanks!

  • I think it would be better to use named attributes (like <sviewer thumbRows='3'>). That makes it easier to overload only some attributes.
  • Request: it would be great to use wildcards in a filename to select a subset of a namspace (gallery has this).
  • Buglet: the first character is missing in the image caption names

Hans Elbers 2012/09/13

Patch to hide sviewer directory

sviewer has an annoying feature: it creates a media-directory that is accessible by @ALL for reading. While this can do little harm (I guess) this directory shows up in the directory-tree of the media-manager. To hide this for naive users you could put the following code in /inc/media.php

/**
 * Build a tree outline of available media namespaces
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function media_nstree($ns){
    global $conf;
    global $lang;
 
    // currently selected namespace
    $ns  = cleanID($ns);
    if(empty($ns)){
        global $ID;
        $ns = dirname(str_replace(':','/',$ID));
        if($ns == '.') $ns ='';
    }
    $ns  = utf8_encodeFN(str_replace(':','/',$ns));
 
    $data = array();
    search($data,$conf['mediadir'],'search_index',array('ns' => $ns, 'nofiles' => true));
 
//inserted Harald Ronge
//prevent sviewer to be displayed by the media manager
//proposal: conf string fo media-manager to to hide directories
    if(!auth_isadmin()){
        for ($index = 0; $index < count($data); $index++){
            if ($data[$index]['id'] == 'sviewer') {
                unset($data[$index]);
                continue;
            }
        }
        $data = array_values($data);
    }
//end inserted
 
    // wrap a list with the root level around the other namespaces
    array_unshift($data, array('level' => 0, 'id' => '', 'open' =>'true',
                               'label' => '['.$lang['mediaroot'].']'));
 
    echo html_buildlist($data,'idx','media_nstree_item','media_nstree_li');
}

Harald RongeHarald
Harald

2012/09/29

Sort images

I would like to have the images sorted by their filename.

The following changes (insert two lines with sort()) in syntax.php will do that for me:

....
          }else{
            // get file path
            $paths[] = $path;
            $urls[]  = $mlink;
          }

          sort($paths);
          sort($urls);
         
          $fsz = count($paths);
          for($j=0;$j<$fsz;$j++){
            $path = $paths[$j];
....

Joe 2012-10-21

plugin/sviewer.txt · Last modified: 2015-04-04 06:02 by PatrickBrown