(:xtitle WikiGallery comments:)

Summary: Talk Page for WikiGallery
Maintainer: sts
Categories: Images

Go back to the WikiGallery recipe

  • 2022-05-24: My wikigallery is not working since I upgraded my server to PHPv7. If anybody could fix it, I would be gratefull, in fact, I could pay for the fix. Please mail me:
  • I am trying to install wikigallery. Everything install correctly, and I can see my different galleries from the Pics.HomePage, but when I go to a gallery there are no thumbnails. I have checked the page source code, and linked to the created thumbnail files, but they are not generated and show no errors. I am not sure if I missed something or...?
  • If there is an empty folder in the ./pictures/dir, the browser shows about:blank. Also if the name of the pic isn't correctly. st
  • I wonder if I'm doing something really stupid, but I get a "500 Internal Server Error" when I try to access Pics.Homepage. The server log shows:
Premature end of script headers: /home/paulcu2/public_html/info/pmwiki.php
The url is
PS My ISP (Lunarpages) has informed me that their servers are setup to use suPHP to parse php pages as CGI instead of an Apache module. Maybe that has changed something?
Any suggestions? Thanks.
  • Can't see the error st
This happens for one of two reasons:
  • Either the webserver does not have read permissions for all directories or files or
  • one of your album directories contains an image file which is not handled by WikiGallery. Those would be for example .tiff or .png files. Cheers, ThomasJ.
  • Works really nicely with DynamicWikiTrails (once I upgraded that cookbook to PmWiki 2.2.0-beta1) for generating on the fly, cross folder, cross $Group picture trails.
  • I have another patch that defines 2 new markups, and make appropriate mods to the picture method and WikiGalleryPicture function. Perhaps there was an easier way to do this already? If not, I can upload a patch for it.JamesM
    • ... Snip ...
    • first one shows an image of the specified size and links directly to the gallery page for this picture.
    • second one shows an image of a certain size, and links to the full size image (essentially, a thumbnail generator)
  • I'm really new to PmWiki, but this seems overkill, is there already a way to do this that I am missing? Perhaps by defining a template or wikistyle or shorthand of some sort? Also, if there isn't, I'd probably rewrite it so that 'full' and 'link' are optional parameters of the first markup rather than new markup. JamesM
    • What about this:
      Markup('(:gallerypicturepage picture:)',
             'fileNameToPageName( \'$1\')');
      It will give you the pagename of the picture. You can then do whatever you like with it:
      [[Pics.(:gallerypicturepage foo.jpg:)|(:gallerypicture 100 foo.jpg:)]]
      This would give you the thumbnail preview. Sts
    • Nice. Of course that is simpler and more generic than my two gallerypicturelink and gallerypicturefull macros, and don'e require modding your functions. Thanks! I'm assuming then that
      [[(:gallerypicture foo.jpg:)|(:gallerypicture 100 foo.jpg:)]]
      would have already done the 'gallerypicturefull' use case. Thanks for all your help on this. JamesM
  • Here is my patch that enables you to specify height, width or both for each gallery image. It's backwards compatible, in my tests. To really use it, you also need to update the templates.
    • com.mortimeronline.pmwiki.wikigallery.rev64.add-height.patch.txtΔ JamesM
    • Thanks for the patch! Looks good, just one problem: The size arguments in the (:gallerypicture...:) markup are now optional. But if the picture name starts with a number followed by whitespaces, this number will come out as height. Example: (:gallerypicture 0 2007 Bla:) will end up as width=0 height=2007, which is not meant here. I don't see how to do that easily at the moment. The only idea would be to use a width:height notion, i.e. (:gallerypicture 0:500 2007 Bla:) to mean a 500 lines high picture 2007 Bla. What do you think? Sts
      • Didn't count on that as all my pictures have no spaces. Good catch.
    • Implemented the width:height idea: . Look here for a test: Sts
    • Another question coming up now: what should it mean to scale a picture to w:h? Should it keep its proportions, i.e. is w:h just the maximum? or should it really be scaled to exactly this dimension. ImageMagick has this w:h! notation for the latter and w:h for the former. What about also taking this convention in WikiGallery? Sts
    • So, I changed it now as follows: w: (the same as w:0 scales to width w and calculates the h automatically. Similar for :h. Giving both arguments w:h scales the picture such that width<=w and height<=h. Giving just a number x as argument is the same as x:x. This should be ok for more or less all use cases of a gallery I think. If somebody needs non proportional sizes, he is free to scale the pictures manually. Sts
    • Looks good, thanks for the collaboration. Agree the main use cases will be for max-width/max-height. However, there were three main use cases I needed this for:
      • a) creating a horizontal 'navigation' bar where each picture is of equal height. Can do this with your or my mod
      • b) forcing a set of pictures that are all approximately 4:3 or 3:4 ratio to be exactly 100x75 or 75x100 for nice layout
      • c) flexible non-gallery sizing for making nice picture layouts on pages without having to resize originals (i.e. I want pictures to be exactly x by y in the top right of page 'Home', but the uploaded pic is 2000x1600), but for simplicity for my novice authors, always using the same gallery functions to scale the picures throughout all use cases
      • so with your mod using 'max dimensions' notation I can't do b) or c). Can you implement the w:h! notation (which makes your patch completely backwards compatible, and a functional superset of my patch that allows specific scaling)
      • otherwise, this opens ALOT of possibilities. Thanks! JamesM
    • Added the ! notation now, look here again: Sts
  • Help Regarding Authorization, AuthAuser, Attributes, GroupAttributes?action=attr, and Site.GalleryHomePageDefault, Site.GalleryHomePageTemplate, Site.GalleryIndexTemplate, Site.GalleryListTemplates, Site.GalleryOverviewDefault, Site.GalleryOverviewTemplate, Site.GalleryPictureDefault, Site.GalleryPictureTemplate
    • Symptom: You can access a Pics/Home page, but no pictures are listed. You can access a Pics/PictureName, but no images are shown. Thumbnails don't show, even though the links are built.
    • Problem: Attributes not set right in your Site.Gallery* files.
    • If your Site group is not readable by all visitors to your gallery, you need to manually override the Attributes on all of the above pages so that they are auth=readable by everyone that you want to have access to your gallery. Otherwise they can't view pictures or list the index etc. If you locked down your Site.GroupAttributes or $DefaultPasswords to only be auth=read by @admins, then you have already re-opened Site.Sidebar and Site.AuthUser pages to get your site working properly. JamesM
      • Q: Will WikiGallery use group-specific overrides, like Pictures.GalleryPictureTemplate, to supercede Site.GalleryPictureTemplate when in the Picture group?

  • Good question, never thought about it. If you have a patch to implement that I would be happy to add it. Sts
  • Another thing I always had in mind was to derive the read property of a picture from the overview page. Not sure if that is possible in current PmWiki. Sts
    • No patch for that, yet :). I am however thinking of given the (:galleryimage markup a backwards-compatible and optional height parameter, so that I can specify either exactly the height, exactly the width, or both (or neither) for flexibility in using these thumbnails in a variety of gallerys and page contexts. By default, in your galleries, I'd prefer fixed-height to fixed-width (current default) for the small thumbnails, and perhaps fixed-width for the main image. I also want to add a parameter to specify the resolution of the image that is linked to. Any suggestions on this? Would you be interested in implementing it (you know the code better than I), or interested in incorporating any patches I make towards this goal? Can I start a branch on your SVN until I get something worth merging back in? (I think it's going to take several sequential mods to get there) JamesM
    • I fear it's not so easy to grant anybody without a system account write access to the subversion repository. But I am happy to review your patches and apply them. I just looked a bit through the code. At the moment I only pass a $size parameter around which corresponds to the width. But it should be straight forward to add both width and height. Setting either to 0 would mean to leave that dimension as it is. The thumbnail code in fact supports this already. You only have to add it everywhere way up to the PageStore. The code is well documented, so you shouldn't have major problems to find the places to change. Sts
  • Change in Rev62 to use $DefaultName now fails to recognize Home OR HomePage on my install
    • Added $DefaultName to global declarations for functions using it. JamesM
    • Thanks again for the report. Didn't take proper care. Sts
    • Um, Rev63 uses $DefaultPage in the global line, but $DefaultName in the code. Should both be $DefaultName. I hope that wasn't a problem with the patch I sent! JamesM
    • Grr, hope it's right now. Don't know why all those errors have no effect on my site. Worked fine with either change. Sts
  • Large 'overview' pages cause all thumbnails to show in a single very very wide line. Adding a space before the \ in the overview template in Site.GalleryListTemplates fixes this problem. JamesM
    • to avoid people looking for the wrong \: This line needs an additional space:
    [[{=$FullName}|(:gallerypicture 120 {=$GalleryPicture}:)]] \ Lighans
    • This is now fixed in Rev 62. Thanks for the report. Sts
  • Installed without a problem. Works well in my config. However, it uses hard-coded "HomePage" text in 3 places, instead of the $DefaultName variable, so if you have changed $DefaultName="Home" or other, links to [[Pics/]] will fail to find your default home page for the Pics group. JamesM
    • Also fixed this in the Rev 62. Thanks for the report. Sts
  • trying an almost bog standard basic install as documented (latest beta under windows XP and apache) (in /local/Photos.php)
    $WikiLibDirs[] = new GalleryPageStore('Photos');
    • I'm not seeing any pictures (see 203 dot 97 dot 214 dot 12/pmwiki/pmwiki.php/Photos)
      • web server is offline daily NZDT 22:00 to 07:00 at the moment sorry
    • I too have the problem with pagelist
    • in step 4 it would be helpful if links or advice on how to check these libraries are installed were supplied
    • when I try the link /pmwiki/pmwiki.php/Photos/Photos?action=thumbnail&width=120&group=Photos I get the message PmWiki can't process your request no image given We are sorry for any inconvenience. It would be helpful it the path searched was displayed, as there are pictures in what I understand to be the correct directory, viz \public_html\pmwiki\pictures\
      • That message means that there is no "image=" in the url. The big question is why. I haven't tried the latest betas myself. Maybe something has changed. I will check...
  • Very cool thx. It is very cool for Blogs too. flox September 16, 2006, at 07:30 AM
  • I installed the latest version, have got no error, but no picture is displayed. Any idea? flox November 13, 2006, at 08:21 AM
    • Hmm, what are the links to the pictures in the HTML output? Any error shown if you enter the picture url directly in your browser? ImageMagick or libgd2 installed? If you cannot get it to work, I am in the PmWiki irc chat more or less all the time. Might be easier to figure it out there. 2006-11-13 Sts
    • I get the following on your page. That should explain it.... PmWiki needs to have a writable cache/Screenshots/ directory Sts
    • Thanks, but it doesn't help...also if I create a directory /floxwiki/cache/cache/Screenshots/ it displays this message. I tried to create /floxwiki/cache/cache/Screenshots/ with only ONE cache/. Then I got this error message: PmWiki needs to have a writable cache/Screenshots/sword_02.jpg/ directory The problem, the server I use, doesn't allow much a script isn't able to create directories. Would it be possible to change wikigallery, so that it doesn't create new directories? Or how can I use phpThumb - the sample above doesn't help... I want to use the /icture/ directory in the same directory as pmwiki.php. Thanks! flox November 13, 2006, at 02:41 PM
    • Try to change the last line of cacheFileName in cookbook/wikigallery/thumb.php into return preg_replace( "/\\//", "-", $path . "/" . $size . "." . $ext );. Then no directories are creates, but flat filenames are used. Sts
    • Try the latest version. I added the $WikiGallery_UseFlatCache variable which is set to true for more compatibility. By default now only flat cache files without addition directories are created Sts
  • I have the same problem with the latest svn version - no pictures shown. Both the pictures and cache directory are owned by the web server and chmodded to 777. Ian?
    • Is it online somewhere where I can see it? Is anything shown, an error message for example if you go to a picture URL directly with your browser? 2006-11-24 Sts
    • Have a look at for the index page and for a single image. No errors are produced on the browser and I can see the image links if I view source. Ian?
    • What is your (wikigallery related) configuration in local/config.php? If I surf to, I don't see any cache file. Is that your cache directory for wikigallery? If you know a bit of PHP, just put some Abort("I am here"); into cookbook/wikigallery/thumb.php. The interesting function would be thumb($path,$width,$height) and scale(...) of the InternalThumbProvider. Would be interesting what PHP is doing there. 2006-11-24 Sts
    • cache directory is present and has permissions of 777. My config.php is minimal:
$WikiLibDirs[] = new GalleryPageStore('Pics');
  • I'll fiddle with thumb.php tomorrow. I suspect that it's somehow a permissions problem.
  • OK it looks as though the Path isn't getting set. I have modified the code to write out a log file of what it's doing. Rather than clutter up this wiki page with debugging info perhaps we could continue via email. You can contact me at ian at manor-farm dot org.
  • Now fixed. I was a problem with my installation of Imagemagick.
  • I like this. But I find when I have this recipe enabled, it messes up the pagelist used for the Category group. Instead of wiki names, I now see a list of URLs that lead to the Pics group. But they don't actually target the URL listed; rather they go to tagged pages. If I comment out the lines that enable this recipe, the Category group works fine! This is with pmwiki-2.2.0-beta16.
    • You have an example online? Some more information would be helpful. Don't have a problem here. 2006-11-22 Sts
    • You can check -- follow any category, and you'll see the problem. In a local copy, I've been trying to hack Site.GalleryListTemplates, to structure it more like Site.PageListTemplates, but not to great success. I just get pieces of GalleryListTemplates appearing on the Category page. What other information would you like? I've commented out all the other extensions I was using on my local wiki, and still see these problems.
    • Hmm, it looks like I can get things to work if, in my Category.GroupFooter I qualify the fmt with Site.PageListTemplate (even if I want to use #default). Or the Category mechanism works if I comment out the modification to $FPLTemplatePageFmt in wikigallery.php, but that of course breaks wikigallery. In any case, I increasingly suspect that the pagelist mechanism isn't quite working right.
      • Very strange... I have the beta running here without a problem. The pagelist in the category group footer works fine. But it really seems to be a beta problem of the pagelist code. Maybe one should try to debug it with pmichaud directly on irc... 2006-11-24 Sts
      • I think what is happening is that wikigallery.php is being loaded before pagelist.php. So it is actually setting the value of $FPLTemplatePageFmt, not appending to it. If I explicitly set $FPLTemplatePageFmt to the default value it is given in pagelist.php, then include wikigallery.php, everything works as advertised. I see that blogsimple2 also sets this variable, so if you used that before wikigallery.php, it probably helps. (Though I have other problems with blogsimple2 that I need to resolve, since I'd really like to use that.) -- rlt, 2006-Nov-29
      • In the Notes above I metioned to install blogsimple2 should be installed first because it changes the WikiLibDir by overwriting it with some constant list. WikiGallery has to append its directory, so it must come after in the config. That might be the reason that it works for me. Not really sure what to do about it. Maybe one should try to fix BlogSimple2? 2006-11-29 Sts
      • I'm not using BlogSimple2. So I added Site.GalleryListTemplates to $FPLTemplatePageFmt in pagelist.php and commented $FPLTemplatePageFmt in wikigallery.php. That is not an ideal way, but makes pagelist and wikigallery work for me.
        • Dude, you hit the nail on the head...excellent debug! -Feature Creep
      • This difficulty is reproducible in my system, even with a clean install, and is corrected with the same fix, and it's not really a bug that can be fixed in wikigallery. As a new user of PmWiki and WikiGallery, I messed around for quite some time before finding this comment above. Even this description above is a bit technical for some admins, so I'm proposing the message below gets added to the WikiGallery documentation (in some form) in the installation instructions as a 'known incompatibility'. JamesM

WikiGallery known incompatibility with PmWiki main application


  1. Any feature that uses (:PageLists:) directives show either a Url from WikiGallery's Site.GalleryPageList or the entire page
    1. messes up the pagelist used for the Category group
    2. messes up BlogSimple2
    3. message up the search results
    4. message up (:Input JumpBox:) directives


  1. pmwiki/scripts/pagelist.php.FPLTemplate function uses SDV to set the default $FPLTemplatePageFmt array, which only sets the required default values if the array doesn't exist (this should add to the array, except then you can't override with an empty array in the config)
  2. pmwiki/local/config.php includes cookbook/wikigallery/wikigallery.php before FPLTemplate is even called, so wikigallery.php.line150 sets the default values for the $FPLTemplatePageFmt array

Best Solution:

  1. Manually add the default locations that would be added by FPLTemplate to your local/config.php, before or after you include WikiGallery.php. This way, you don't have to modify any distribution source (pagelist.php or wikigallery.php) which will simplify upgrades at a later date. -- JamesM ->
-- permission granted to delete this block if moved to main page JamesM
Thanks JamesM, I thought I would have to choose between this gallery and pagelists (of which the latter would win). This should definately be part of the cookbook itself as I would not of been able to get it working without the above code lines. Hopefully there won't be any other weird issues... Philip
  • I had to add $FarmD/cookbook/wikigallery/ to all the lines with require_once to make it work lighans December 11, 2006, at 08:37 AM
    • As far as I understand, the current path should be search first with require_once. But maybe your webserver has a custom configuration for whatever reason. Mo 2006-12-11 - 11:48 Sts
    • I don't know enough about programming to help here. For me it means I have to be alert when upgrading wikigallery....Thanks for the answer.
  • I have just installed WikiGallery and get the following error message, see below.
    Any help would be appreciated. kindd December 13, 2006, at 13:54 GMT.
    Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of register_shutdown_function(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /usr/local/apache2/htdocs/pmwiki-2.1.26/cookbook/wikigallery/thumb.php on line 129
    Using PHP 5.0.4
    • Welcome in PHP object model hell. Fortunately it's only a warning, and not an error until now. If you turn off warnings, which is suggested for production system anyway, you are fine for now. I will look into it later 2006-12-14 Sts
      • Problem fixed. In the php.ini configuration file, set allow_call_time_pass_reference = On. Thanks for the tip.
    • The problem is well known: WikiGallery expects a unix like system, not Windows (at least a little piece of code in thumb.php does). To fix that (for the time being; have to fix it properly in thumb.php later), just comment out the line 129 in thumb.php (the one with the call to the unix find command). The only sense of it is that old thumbnails are removed if there are not accessed for some time. In most cases this is not really necessary anyway.
  • Nice cookbook. However, the zip file includes a lot of files and it's difficult to manage it/change it. Are they all important? Which file is used when providing the template for the hmtl? I'd like to change the structure of the html but I'm not sure which one I should change? Can someone please advice? Thanks in advance.
    • The templates are in the wikilib.d directory. The files are all used. Usually it shouldn't be necessary to change them yourself though. All the visual customization is done with the wikilib.d templates. Sts
    • Thanks for the quick response. Withing the wikilib.d directory there is the .svn folder which has quite few files. Which one is used when creating the template? In particular, I'd like to change the floating pictures to a simple table. Also, where do I set the quality of the picture as it seems to be quite low. Thanks in advance.
    • The .svn directories are from my subversion checkout. You can just ignore or delete them. They are not used. For the floating pictures template, take a look at Site.GalleryListTemplates. The Site.GalleryOverviewDefault page is the template in fact, but it only uses a pagelist from the former.
  • Hi. Great gallery! A list of localisation variables would be very useful.
  • I got the error
   Warning: touch() [function.touch]: Utime failed: Operation not permitted in [url-snip]/wiki/cookbook/wikigallery/thumb.php on line 358
i solved it by adding unlink(".cleanup-timestamp"); into the line 357
  • Hi! Great cookbook! I would like to add a $GallerySize var in every thumbgallery generated in Pics.HomePage. Actually i can see a rectangle which includes a random photo from the gallery and the gallery title (from the directory). I would like to add the $GallerySize var side by side. How to do this?
  • 15 Nov 2007 - Hi, I've just installed this wonderful script but my pictures aren't being generated! I've confirmed with the webprovider that ImageMagick is installed but all I get is a blank page.

    If I use the following , nothing appears. But if I remove the width and height setting, my picture actually appears -
    My gallery is at Images are in Any help would be much appreciated!
  • 10 March 2008 : Hi, I've installed this cookbook, all work fine, except I can't save Site.GalleryListTemplates. I found that it's that line who bugs : (:gallerypicturerandom 120 {=$GalleryAlbum}:)
    Why ? TS
  • 12 March 2008 - Hey there. Love the gallery. Tried this question on the mailing list, didn't get a response, so trying here. On the index page (one that shows a random picture from each subdirectory in that directory), the pictures don't line up right if you have both portrait and landscape oriented pictures. Here is an example: [(approve links) edit diff]. If you don't see it, try reloading, and there will probably show up a vertical picture that throws off the rows. This doesn't happen for galleries that are showing all of the pictures in a particular directory. Any ideas?
    thanks, maria
  • 7 December 2008 - I've installed the recipe, but I have the same error as TS above. I can't save Site.GalleryListTemplates. Anybody have a fix? PP

Add a comment

Talk page for the WikiGallery recipe (users?).