PhotoBlox plugin is a simple usage of the PhotoBlox application in DokuWiki.
PhotoBlox is an image viewing Internet application that can be embedded into a personal blog template or Web page, and displayed in any modern Web browser. With some simple editing of an external XML configuration file, you can:
With this plugin you can easily set up the PhotoBlox application. The only thing you have to specify is the location of the images to display which can be any directory on the server which is accessible.
Unfortunately the offical PhotoBlox site is down for a time ago. I don’t know what’s the problem with them. If it will be on-line, I will get the source code and change it to can be used as a local service. — Csík Norbert 2006.03.19 23:34
The syntax is very easy, it’s a modified format of the media link syntax:
{PB{path/to/image/dir}}
The pointed directory should contain other directories called galleries. The galleries should contain the files you would like to show in the gallery. Every file in the galleries will shown in the application.
PhotoBlox can display JPEG, GIF, PNG and SWF files of arbitrary dimensions. For best viewing performance, authors recommend compressing files to 100 Kb or less.
Check out my PhotoBlox Example page.
Put these configuration parameters to the conf/local.php file and modify them to fit your needs.
$conf['photoblox']['path'] = '/file/system/path/to/image/root/'; // System path to the images. Used to create the list of files. Can be relative path too, in that case ../../../ is the DokuWiki root directory. $conf['photoblox']['url'] = 'http://www.myhost.com/'; // Web path to the images. Used to download the images to the client. $conf['photoblox']['fit'] = 'view2image'; // Fit image to view or the view to the image (image2view, view2image) $conf['photoblox']['effect'] = 'pan'; // Available in image2view mode (pan, zoom) $conf['photoblox']['effecttime'] = '6000'; // Milliseconds $conf['photoblox']['crossfadetime'] = '3000'; // Milliseconds $conf['photoblox']['slidedelay'] = '6000'; // Milliseconds $conf['photoblox']['playallgalleries'] = 'false'; // In show mode plays all gallerys (true, false) $conf['photoblox']['useframe'] = 'true'; // Frame around the image (true, false) $conf['photoblox']['framewidth'] = '10'; // Frame size in pixels
Plugin sources: zip format (3k)
If your wiki uses either the plugin manager plugin you can use them with the links above to install the plugin.
To install the plugin manually, download the source to your plugin folder, lib/plugins and extract its contents. That will create a new plugin folder, lib/plugins/photoblox, and install the plugin.
The folder will contain:
syntax.php plugin script list.php content xml generator script
The plugin is now installed.
The plugin consists of two files, the plugin script syntax.php, and the content XML generator script list.php.
<?php /** * Plugin PhotoBlox: Uses BlogBox's PhotoBlox application to show galleries * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Norbert CsĂk <norbert.csik@gmail.com> * @version 0.6.1 */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class */ class syntax_plugin_photoblox extends DokuWiki_Syntax_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Norbert CsĂk', 'email' => 'norbert.csik@gmail.com', 'date' => '2006-03-08', 'name' => 'PhotoBlox Plugin', 'desc' => 'Uses BlogBox\'s PhotoBlox application to show galleries', 'url' => 'http://www.csik.net/project:photoblox', ); } /** * What kind of syntax are we? */ function getType(){ return 'substition'; } /** * What kind of syntax do we allow (optional) */ // function getAllowedTypes() { // return array(); // } /** * What about paragraphs? (optional) */ // function getPType(){ // return 'normal'; // } /** * Where to sort in? */ function getSort(){ return 999; } /** * Connect pattern to lexer */ function connectTo($mode) { $this->Lexer->addSpecialPattern('\{PB\{.*?\}\}',$mode,'plugin_photoblox'); } /** * Handle the match */ function handle($match, $state, $pos, &$handler){ switch ($state) { case DOKU_LEXER_ENTER : break; case DOKU_LEXER_MATCHED : break; case DOKU_LEXER_UNMATCHED : break; case DOKU_LEXER_EXIT : break; case DOKU_LEXER_SPECIAL : return array(substr($match, 4, strlen($match)-6)); break; } return array(); } /** * Create output */ function render($mode, &$renderer, $data) { if($mode == 'xhtml'){ $protocol = (isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on') ? "https://" : "http://"; $host = $_SERVER['HTTP_HOST']; $dir = dirname($_SERVER['PHP_SELF']); $url = $protocol.$host.$dir; $renderer->doc .= "<script type=\"text/javascript\" language=\"JavaScript\" src=\"http://www.mylaszlo.com/lps-krank/includes/embed.js\"></script>"; $renderer->doc .= "<script type=\"text/javascript\" language=\"JavaScript\">"; $renderer->doc .= "lzEmbed({url: 'http://www.mylaszlo.com/lps-2.0/showcase/photoblox/photoblox480x480.lzx?lzt=swf&data_url=".urlencode($url."/lib/plugins/photoblox/list.php?dir=".$data[0])."', bgcolor: '#ffffff', scale: 'noscale', width: '480', height: '480', menu: 'false'});"; $renderer->doc .= "</script>"; return true; } return false; } }
<?php /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Norbert Csík <norbert.csik@gmail.com> */ header("Content-Type: text/xml; charset=utf-8"); if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../').'/'); if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/'); require_once(DOKU_CONF.'local.php'); $dirname = $conf['photoblox']['path'].$_GET["dir"].'/'; $hostname = $conf['photoblox']['url']; echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; echo '<photobloxdata>'; echo '<customize '; // fit if ($conf['photoblox']['fit'] == 'view2image') { echo 'fitimagetoview="false" fitviewtoimage="true" '; } elseif ($conf['photoblox']['fit'] == 'image2view') { echo 'fitimagetoview="true" fitviewtoimage="false" '; } // effect if ($conf['photoblox']['effect'] == 'pan') { echo 'pan="true" '; } elseif ($conf['photoblox']['effect'] == 'zoom') { echo 'zoom="true" '; } echo 'playallgalleries="'.$conf['photoblox']['playallgalleries'].'" '; echo 'useframe="'.$conf['photoblox']['useframe'].'" '; echo 'crossfadetime="'.$conf['photoblox']['crossfadetime'].'" '; echo 'slidedelaytime="'.$conf['photoblox']['slidedelay'].'" '; echo 'panzoomtime="'.$conf['photoblox']['effecttime'].'" '; echo 'motionmode="linear" zoomdepth="2" frameurl="lzmodules/assets/drop_shadow.png" origframesize="64" '; echo 'artframewidth="'.$conf['photoblox']['framewidth'].'" '; echo '/>'; $dir = opendir($dirname); while ($subdirname=readdir($dir)) { if ($subdirname != "." && $subdirname != ".." && is_dir($dirname."/".$subdirname)) { echo ' <gallery name="'.$subdirname.'">'; $subdir = opendir($dirname."/".$subdirname); while ($file = readdir($subdir)) { if ($file != "." && $file != "..") { echo "<image><imageurl>".$hostname.$_GET["dir"]."/".$subdirname."/".$file."</imageurl></image>"; } } echo ' </gallery>'; } else { echo $subdirname; } } echo '</photobloxdata>'; ?>