Summary: Integration in PmWiki of the refined gallery TinyWebGallery
Version: 26 Feb. 2006 - updated this page (config) 18 Apr. 2006
Status: Stable
Prerequisites: pmwiki-2
Maintainer: PRZ
Categories: Images


How to incorporate in pmwiki the gallery TinyWebGallery


1/ Have a look on the TinyWebGallery possibilities and download it.

2/ Install the gallery in a directory named 'twg' (lowercase, please), located in the root of your public html directory.
Do not forget to give proper access rights to directories.

3/ To configure this gallery copy the config.php file in myconfig.php file (do not confuse with the pmwiki config.php !) then modify the myconfig.php file to customize your install.
Remove all gallery examples situated in /twg/pictures directory before opening the gallery
(if you do not, there will be cached files in twg/cache and twg/xml directories, to be removed later) In the myconfig.php file, find the line $debug_file = dirname(__FILE__) . '/' . $xmldir . '/_mydebug.out'; and replace it by $debug_file = ''; . If you don't do that you will have a debug file growing indefinitely up to your system failure.

4/ In your pmwiki config.php file, write the following lines

 # Markup to insert the TinyWebGallery
Markup('twg', '<block', '/\\(:twg\\s?(.*?):\\)/ei',
 "Keep('<iframe src=\'/twg/index.php?twg_album=$1\' frameborder=\'0\'
    width=\'100%\' height=\'722\' rel=\'nofollow\'></iframe>')");

Note: set the 'Keep' function on a unique line, it have been sliced here for presentation only.

5/ In the page where you want to display a gallery write the line

 (:twg Gallery:)

Where the 'Gallery' is the name of the directory located in /twg/pictures/ which contains the photos to be displayed.

if you don't set any parameter to the directive, say


all galleries will be proposed


The parameter height=722 is adapted to the default configuration of the TinyWebGallery,
which shall be adapted if you modify parameters which influence the size.

  • This recipe was last tested on PmWiki version: 2.2.71
  • This recipe, version 0 was installed here the 5 nov. 2005

This recipe may not work on PHP 5.5 see CustomMarkup. I failed to obtain a working markup on PHP5.5 -PRZ-

Since pmwiki version 2.1, there is trouble with directory names which are wikiwords (because wikiwords are set between <span> markups). So, you should modify the directory names and related calls, e.g.:

(:twg Machines/BigCN:)

should became

(:twg Machines/Bigcn:)



I'm having issues getting this recipe to work on my wiki. I've got an issue open in PITS, but it was suggested I post here. Thanks for your help, I can't wait to get this working. 01097 -jeff- 7 may 2009

  • TWG is a nice gallery
  • Todo: suppress the iframe
  • question: how to automatically be logged in when accessing the wikipage?

-jlv- 17 november 2005

-twg- 12 december 2005

Thank-you so much -- that did the trick! Cari, 19 April 2006.

There is a debugging file defined in the default twg config.php file. This is not a good idea, because that file is growing indefinitely, up to the crash of your system. Sort of time bomb...
Solution: Erase the _mydebug.out file in 'xml' directory via FTP and modify your config file (myconfig.php) as I just explained in step 3/ - This shall be done by ALL twg users -. The problem being yet only discovered by those having a heavy trafic, for the others this is just a question of time... I have also discovered recently the problem and missed to report here. PRZ

  • Question* I have TWG integrated with PMwiki. But the twg markup can only access galleries that are under ../../pictures. If I setup a 2nd root directory for a specific user like ../../picturesKim I'm not able to access these through PMwiki. Any thoughts on this? DJF3 -> mailto:pmwiki [snail] nldj [period] com

See Also



Für a W3C confirm installation of a TinyWebGallery into PmWiki use the following markup:

4/ In your pmwiki config.php file, write the following lines

 # Markup to insert the TinyWebGallery
Markup('twg', '<block', '/\\(:twg\\s?(.*?):\\)/ei',
 "Keep('<iframe src=\'/twg/index.php?twg_album=$1\' frameborder=\'0\'
    width=\'100%\' height=\'722\'></iframe>')");

Category: Images

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.