MoinMoin Gallery Macro

Description

A photo gallery written by SimonRyan and implemented as a MoinMoin macro.

<simon AT smartblackbox DOT com>

Feature List

Download & Release Notes

Download

Release Version

Moin Version

Release Notes

Gallery-087.py

1.2, 1.3, 1.5

Gallery-086.py

Gallery-082.py

1.2

Installation

Usage Guide

Parameters

As of version 0.80 the parameters are as follows:

Advanced Options

gallerytempdir

The default behaviour is to serve the images via MoinMoin's internal attachment view facility. This has the downside that each image then causes a separate invocation of the MoinMoin application.

There are a number of ways around this such as:

These methods have pros and cons, the cons including serious security implications.

The preferred method for getting around this is to insert an extra couple of parameters into your wikiconfig.py:

These point to a directory which you have created to be writable for the MoinMoin process and readable by the webserver process such that it can serve images placed there as items in it's urlspace.

The Gallery macro will create a new directory for each pagename that utilises the Gallery macro, it will then, on first view, populate it with thumbnails and webnails for the images contained in the pages attachements directory, eg:

in the DesktopEdition, the base url_prefix is the folder moin-desktop/wiki/htdocs

Example

SampleGallery

FAQ

Question: I uploaded a heap of images and only some of them seem to be displayed as thumbnails.

Answer: New images are processed into thumbnails and webnails by the Gallery macro. If this process takes longer than 40 seconds, then rather than keeping you waiting, the processing moves into the background. You should see a message displayed when this occurs.

Question: Why didn't you implement feature X?

Answer: Probably because this macro was thrown together on the weekend :) If you have a feature suggestion, bug (or preferably bug-fix), please email it to me.

Question: Why is thumbnail view so slow to appear on my browser?

Answer: By default the macro delivers images using MoinMoin's internal attachment view mechanism. Read the Advanced section of the documentation and implement the moin_config gallerytempdir and gallerytempurl variables or change your configuration to use FastCGI.

Question: If I am using the wikiconfig.attachments style of attachment download speedup, will it still work?

Answer: Yes you can, as of version 0.81, but the support is currently experimental.

Change Log

Other Galleries for MoinMoin

This implements the idea of Gallery as a combination of a MoinMoin Action and Parser as opposed to a Macro.

Bugs

If you're using the Macro on a pagename with Umlauts an error "ascii' codec can't encode character " appears.

ascii' codec can't encode character u'\xe4' in position 39: ordinal not in range(128)

    * args = ('ascii', u'<td><a href="http://intranet.heavy.ch/H\xe4fner, Ma...il.person.jpg" alt="" title=""></a></center></td>', 39, 40, 'ordinal not in range(128)')
    * encoding = 'ascii'
    * end = 40
    * message = ''
    * object = u'<td><a href="http://intranet.heavy.ch/H\xe4fner, Ma...il.person.jpg" alt="" title=""></a></center></td>'
    * reason = 'ordinal not in range(128)'
    * start = 39

See Log UmlautError_Gallery.txt. Using MoinMoin 1.6.2. -- MarcelHäfner 2008-04-07 11:36:49

Discussion

I may have found an issue on line 450 when using gallerytempdir settings. Say that there are two places where Gallery is used - Example/Example1 and Example/Example2. When processing the second line 450 is trying to create the Example directory again.

os.mkdir(Globs.gallerytempdirroot+compbit)

This will raise an exception since Example exists. This might solve things:

if not os.access(Globs.gallerytempdirroot+compbit, os.F_OK):

-- Magnus 2006-06-07 00:41:08

Do you have any idea for porting this to Windows version of MoinMoin? -- silee 2005-10-03 07:41:08

This macro seems not to be compliant to none-ascii platforms (korean in my case). It throws UnicodeErrors when I insert none-ascii characters as annotation. I've tried to modify the code as follows.

It works well until now but I am not convinced. - silee 2005-10-03 11:27:49

Since you have the capability of looking to a gallery directory outside of the wiki space, you can seperate out thumbnail and metadata creation to a seperate script. The script could be run from cron or manually. Something similar to Curator. You could then also include really advanced functions that take too much computation like wavelet similarity comparisons that could be adapted from imgSeek. -- TimCera 2005-10-27 13:09:51

When I click a thumb instead of showme the real image size it go to Edit Wiki mode, what's wrongn ? --Walter 26/03/2007

DanParslow writes: Thanks for this terrific macro. I did find that when placing galleries in a long page where they were scrolled off, it was inconvenient to have to keep scrolling down the page while navigating through the images. I modified it to automatically include and use anchor tags if you provide the argument anchor=youranchorname. A diff against .87 follows:

--- Gallery-087.py     2008-01-02 23:18:21.000000000 -0800
+++ Gallery.py  2008-01-02 23:16:49.000000000 -0800
@@ -67,2 +67,4 @@
     webnailwidth='600'
+    anchor=''
+    anchortag=''
     numberofcolumns=4
@@ -114,3 +116,3 @@
         description=query
-    return '<a href="'+Globs.baseurl+pagename+'?'+querystring+'='+query+Globs.bcomp+'">'+description+'</a>'
+    return '<a href="'+Globs.baseurl+pagename+'?'+querystring+'='+query+Globs.bcomp+Globs.anchor+'">'+description+'</a>'
 
@@ -121,3 +123,3 @@
     # Append the action to the end of the URLS. This allows us to keep modes such as action=print
-    thumbs='<a href="'+Globs.subname+'?'+Globs.bcomp+'">THUMBS</a>'
+    thumbs='<a href="'+Globs.subname+'?'+Globs.bcomp+Globs.anchor+'">THUMBS</a>'
     index=positions.index(target)
@@ -126,7 +128,7 @@
         # We are not the first so we can provide a back link
-       back=qlink(Globs.pagename, querystring, positions[index-1], 'PREV')
+        back=qlink(Globs.pagename, querystring, positions[index-1], 'PREV')
     if not index==len(positions)-1:
         # We are not the last so we can provide a forward link
-       forward=qlink(Globs.pagename, querystring, positions[index+1], 'NEXT')
-    return '<table><tr><td>'+back+'</td><td>'+thumbs+'</td><td>'+forward+'</td></tr></table>'
+        forward=qlink(Globs.pagename, querystring, positions[index+1], 'NEXT')
+    return Globs.anchortag+'<table><tr><td>'+back+'</td><td>'+thumbs+'</td><td>'+forward+'</td></tr></table>'
 
@@ -383,2 +385,4 @@
     Globs.pagename=''
+    Globs.anchor=''
+    Globs.anchortag=''
 
@@ -396,2 +400,5 @@
                    Globs.webnailwidth=value
+               elif key=='anchor':
+                   Globs.anchor='#'+value
+                   Globs.anchortag='<a name="'+value+'">'
                elif key=='numberofcolumns':
@@ -716,3 +723,3 @@
            return macro.formatter.rawHTML( Globs.adminmsg )
-       out.write('\n<table>')
+       out.write('\n'+Globs.anchortag+'<table>')
        cease=''
@@ -733,3 +740,3 @@
                # Table entry for thumbnail image
-               out.write('<td><a href="'+Globs.baseurl+Globs.pagename+'?webnail='+item+Globs.bcomp+'"><center><img src="'+Globs.gallerytempurl+'tmp.thumbnail.'+item+'.jpg" '+rollover+'></a></center></td>')
+               out.write('<td><a href="'+Globs.baseurl+Globs.pagename+'?webnail='+item+Globs.bcomp+Globs.anchor+'"><center><img src="'+Globs.gallerytempurl+'tmp.thumbnail.'+item+'.jpg" '+rollover+'></a></center></td>')
            out.write('</tr>\n')

MoinMoin: MacroMarket/Gallery (last edited 2008-08-03 00:33:05 by MelaEckenfels)