Project MoinMoin Gallery
MoinMoinGallery is a photo gallery written by SimonRyan and implemented as a MoinMoin macro.
Documentation: /UserDocumentation
Demonstration: /SampleGallery
Download: Gallery.py - stable
History
Despite not having a clone (AdamShand/2004-05-11) I feel it is time to extend my number of active personal projects beyond the boundaries of sanity and reason and embark upon a manifestation of the long sought after and so far mythical beast, known only to the faithfull as MoinMoinGallery. -- SimonRyan
This notice is placed here in acknowlegement of the many facets of Adam's mind I unceremoniously stole from
In particular:
GallerySoftware - The feature wish list at the top.
Full Feature List
- All original images reside as attachments to pages
A gallery is displayed on the page at the position the Gallery macro is inserted eg: [[Gallery(key1=value1,key2=value2....)]] where the following keys are valid:
- thumbnailwidth = no of pixels wide to make the thumbnails
- webnailwidth = width of the web sized images
- noofcolumns = no of columns used in the thumbnail table
default values are used when there are no arguments [[Gallery]]
A small file is added to the attachments directory called delete.me.to.regenerate.thumbnails.and.webnails (usefull to delete if you have changed the width definition arguments)
- Image manipulation is done by PIL (if you have it) or in a forked Image Magick process (convert and mogrify)
- Click once on a thumbnail to get the webnail, click again to get full sized image
- Simple 1 line annotation (so far)
Simple temp filename convention so sysadmins can easily find and --exec rm -f {}\; them
- tmp.thumbnail.imagename.jpg
- tmp.webnail.imagename.jpg
- tmp.annotation.imagename.txt
- tmp.rotated.imagename.txt
- Navigational Bar with PREV, THUMBS and NEXT links
- Tool Bar with Rotate buttons (only visible to administrators but I may make this configurable)
Rotating originals does not actually change the original but creates a tmp.rotated.imagename file which is preferentially linked to
- All form input is reduced to alphanumeric characters for cgi security
Any forked processes running for longer than some delay (40 seconds) are detached from the moinmoin cgi process before the web browser times out (or preferably before the user falls asleep
) - Thumbnail and Webnail generation use file locks to prevent system administrator nightmares
- Authentication: If a user can delete a page, then they are considered a gallery administrator (and can rotate, annotate and trigger a rebuild of the thumbnails and webnails) (This will probably become configurable)
Support added for MoinMoin-1.3.3, MoinMoin-1.3.4 and MoinMoin-1.5.3 (still experimental at this stage so YMMV)
Change Log
22/07/06 - Version 0.87
- Added a delete button - It's just so much easier to delete from the webnail than trying to figure out which attachment to delete
- Now works with latest Moin version 1.5.3 (4?)
- Rotate now no longer rotates (and degrades) the original image. Only the thumbnail and webnails are rotated.
- Fixed various bugs (thanks to all those who contributed fixes - if I'm missed merging in yours, please remind me)
- PIL support seems stable now.
19/08/05 - Version 0.86
- Fixed the rotate refresh issue so that rotate refreshes correctly
- Fixed the subpages bug
- Now uses wikiconfig rather than older moin_config
- Added experimental support for PIL
05/2/05 - Version 0.85
Support for MoinMoin version 1.3.3 (actually 1.3.x is much nicer to code to, so I probably should abandon support for 1.2.x at some stage and recode the script to take advantanges of all the new goodies)
- Added an allowedextensions list to allow image types to be hard coded (this may change soon)
- Some nicer messages displayed when permissions are wrong or directories missing
12/7/04 - Version 0.82
- Bug fix for handling of spaces in filenames
10/7/04 - Version 0.81
Added support for moin_config.attachments dictionary at the request of ReimarBauer (note that configuring moin in this way has implications if you have PHP or any other server parsed language installed on your web server)
9/7/04 - Version 0.80 - Stable release now also at MacroMarket
- Parameters are now comma delimited key value pairs
- Bug Fixes including issue with rotations surviving nail regeneration fixed
- Improvement to the way annotations work
- cleaner html generation
8/7/04 - Version 0.74
- Users with privileges to delete pages are considered Gallery administrators for those pages
- Macro error messages are more pronounced
- Double quotes in annotations are now handled correctly
- More code cleaning and fixes in preparation for version jump to 1.0
7/7/04 - Version 0.73
- Various cosmetic changes (thanks go to Adam for some of these) including:
&action=content tweak for original sized images.
ImageMagick convert called with width+'x'+width
Thumbnails are now <center>'ed in each table cell
- error messages now make more sense
- The order of the parameters has changes to enable future deprecation of the tablewidth parameter
- Various cosmetic changes (thanks go to Adam for some of these) including:
6/7/04 - Version 0.72
- Lots of fixes, improved error messages + GPL info
- Deamon mode also builds all webnails
5/7/04 - Version 0.71
- Added daemon mode for bulk thumbnailing
4/7/04 - Version 0.62
- Toolbar with Rotate Buttons
added action=show to all url requests to hopefully cure the Unknown action error
- two new optional variables for your moin_config.py to greatly speed up thumbnail display
- gallerytempdir (the path to a writable directory)
- gallerytempurl (the path in your webservers url space where this directory can be read from), eg:
gallerytempdir = '/var/www/html/nails' gallerytempurl = url_prefix+'/nails'
- Added a file cleanup system for when users migrate to the new gallerytempdir system
Galleries in subpages should now work (although I've now uncovered some moinmoin bugs to sidestep
) - I'm trying to use POST for all forms
- added alt= and name= to the thumbnails (this achieved the floating label effect I was after)
3/7/04 - Version 0.5
- I've introduced version numbers and we are currently at 0.5
- Security fixes and code modularisation
- Navigational Bar
2/7/04 The initial version is now done.
Known Bugs
- Continued rotation will degrade the tmp images (but they can be forced to regen)
- When running in PIL mode GIF images fail to be converted into jpg nails.
Possible Features
- I'm thinking of storing rotational meta data somewhere, so if the images are regenerated, then any previous rotations will be restored.
Comments might use subpages eg: /image4 which means I could macro include wiki marked up pages under each image (maybe in the webview mode)
- Anything I've missed from Adam's wish list can be included (except maybe the file syncing stuff although I'm open to suggestions)
Using EXIF data or the IptcSpecification for annotations / captions.
- Extracting other EXIF/IPTC data for display
- a parameter for popping n photos off the stack. What do I mean? Place three gallery macros on the same page thus:
[[Gallery(pop=3)]] Some wiki markup possibly describing the first three photos [[Gallery(pop=4)]] Some more descriptions about the next 4 shots [[Gallery(pop=all)]] The rest of the photos in the stack are thumbnailed from here on
Other Galleries for MoinMoin
Another excellent alternative is the recent ParserMarket/Gallery2 by ReimarBauer
This implements the idea of Gallery as a combination of a MoinMoin Action and Parser as opposed to my Gallery which is implemented as a Macro.
Discussion
By all means, steal away!
Let me know if I can help ... -- Adam
Once I'm a bit happier with the code I'll submit it to the MacroMarket
Anyone know if there is a unix command line tool for read/writing EXIM captions?
You can read IPTC captions with the ImageMagick convert tool, though you have too deal with some weird binary character crap (I just filter through strings as a cheap hack). The proper answer would be to use PIL (the Python Imaging Library) which will let you do all the image manipulation and read/write EXIF/IPTC (see IptcSpecification) MetaData. Ah, I knew there was a PIL example around somewhere. -- AdamShand
- Cool, I'll look into this -- Simon
Currently images are fetched using moinmoin which means that for each thumbnail on a page, a separate moinmoin process is forked (yuck) - This can now be fixed with the galtemppath and galtempurlpath moin_config variables.
- I kind of like the idea of keeping temp files separated from the originals.
Yep I like this idea as well. Only gotcha I can think of is that you'll need to make sure there's no way for people to upload .php (or any other server parsed file type) as that can be a security risk (and is how this server got rooted a few months ago <grr>).
- Ahhh, I was wondering how that happend. How did you fix this?
Okay so I've installed it on spack.org and it seems to be working (see MoinMoinGallery/SampleGallery). Cool!
Comments:
- Maybe use leading .'s for the delete.me.to.... file so it doesn't show up in the attachment list (or better, do as you mention above and move all that stuff to another directory).
- I like being able to see the delete.me.to.... file so I can remotely force temp files to regenerate by deleting it with the attachment interface, but maybe I should look into changing the temp files to be (dot) files... good point, I think on this.
- I don't seem to be getting any navigational or annotation options. I'll have a poke through the source and see what I can dig up.
- Hopefully I've fixed this since I never envisaged running a gallery in a subpage. I planned to use subpages as comment pages or discussion pages linked to the images.
- The first time I put it into a page I got a traceback error, it went away after I uploaded some pictures, but now I can't make it happen again. Not quite sure what's going on but there was something weird.
Hacky code.
- Which I click on any of the thumbnails I get "Unknown action" for the "?webnail=image_name" URL I get directed to.
- I think this is because I installed moinmoin-1.2.1 on my Gentoo system and this version is less fussy. Anyway I've added some parameters to hopefully get around this.
I think you can use CSS to make the thumbnails automatically reflow to whatever space is available instead of using tables. I'll see if I can track down some sample code if you're interested. (Update, here it is, once things have settled down interface wise I'll see if a conversion to CSS based design is feasible).
- Cool. I'll check it out. -Simon
- Would be great to have an option to select what picture I want to have the thumbnail of. IE, when writing a longer piece of text, it would be cool to have something like:
[[Gallery(imagename=picture1)]]
I could then have another picture a bit further down the story. That way I come closer using it in a cms-kind of way. Otherwise, Excellent work!Seems like a reasonable suggestion, though it might be easier to just have a much simpler "ThumbNail" macro which does what you want. -- Adam.
Well I'm not much of a coder either, my main job has been moral support for SimonRyan who did all the coding. Unforunately Simon's been quite busy recently and I think his itch has been scratched so you may be better off figuring out something on your own. -- Adam.
- Heh heh, yep. It's started itching again though.
Without GallerySubpage.patch, using the Gallery-0.85 in a subpage generates bogus html that doesn't display the attached pictures, and botches the navigation links. -- GaryVaughan
- This should be fixed now in version 0.86 onwards
Feedback on 0.87 - I've upgraded the sample gallery to the latest version and a couple weird things happened. -- AdamShand
- At first when I clicked on all of the thumbnails it went to the "action=edit" page instead of the "action=show" page. Deleting the file "delete.me.to.regenerate.thumbnails.and.webnails." and reloading the page fixed it.
- There was a .bmp and a .gif file that someone had uploaded. It couldn't generate thumbnails for either of them, and I kept getting the "generating thumbnails" message on the page until I deleted the .gif and .bmp pictures. As far as I could see there was no actual process running on the server so I looks like the macro got confused about where it was at.
Trying to get rid of the "generating thumbnails" message I deleted "tmp.lock" and then when I reloaded the page I got a MoinMoin error page which said something about "unable something to P ". I know that's not terribly useful but I can no longer recreate it to get your better details.
Attached Files
- [get | view] (8.8 KB) attachment:Gallery-050.py
- [get | view] (17.0 KB) attachment:Gallery-060.py
- [get | view] (18.3 KB) attachment:Gallery-062.py
- [get | view] (20.7 KB) attachment:Gallery-071.py
- [get | view] (20.7 KB) attachment:Gallery-072.py
- [get | view] (21.4 KB) attachment:Gallery-073.py
- [get | view] (21.4 KB) attachment:Gallery-074.py
- [get | view] (22.4 KB) attachment:Gallery-080.py
- [get | view] (22.8 KB) attachment:Gallery-081.py
- [get | view] (22.8 KB) attachment:Gallery-082.py
- [get | view] (23.9 KB) attachment:Gallery-085.py
- [get | view] (26.0 KB) attachment:Gallery-086.py
- [get | view] (28.0 KB) attachment:Gallery-087.py
- [get | view] (6.5 KB) attachment:GallerySubpage.patch