arnica

arnica is based on the ParserMarket/Gallery2 parser. It is an extension for MoinMoin >= 1.7.2.

The arnica extension gives you the opportunity to organize images and present them in your wiki. It supports some basic image processing operations by enabling an optional tool set. The action arnica_slides is used to play a slideshow of the selected images.

Requirement
python + PIL (python image library)

1.9/1.8 installation

Because 1.8 supports multiple plugin directories, you can also, instead of downloading the zip files, just check out the repository:

cd /some/where
hg clone http://hg.moinmo.in/moin/extensions

and add the appropriate configuration option in wikiconfig of 1.8:

plugin_dirs = ['/some/where/extensions/data/plugin']

You still need to use the htdocs as above, but you can just symlink from the repository checkout into your web server's directory.

Configuration

The action and the parser are based on css. You have to enter the config var html_head into your wikiconfig.py.

   1 html_head = '''
   2 <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="%(url_prefix_static)s/arnica/css/text_x_arnica.css">
   3 <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="%(url_prefix_static)s/arnica/css/arnica_slides.css">
   4 <!-- css only for MSIE browsers -->
   5 <!--[if IE]>
   6 <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="%(url_prefix_static)s/arnica/css/msie_arnica_slides.css">
   7 <![endif]-->
   8 ''' % {"url_prefix_static": DefaultConfig.url_prefix_static}

since 1.9 we need to pass url_prefix_static.

Parameters

name

default

description

target_page

u''

page to read attachments from. empty pagename is current page. For album_overview, target_page is a string for title search. Alternatively it is possible to use regex:... or category:... (e.g. regex:title:.* for all pages)

columns

4

number of columns for thumbnails. columns=0 means thumbnails flow onto new line is needed thumbnails are aligned on top now

file_regex

u'.'

regex for selecting images

image_for_webnail

False

if set then the image is shown instead of the webnail

show_text

True

default shows description

show_date

True

default shows date from exif header if available

show_tools

False

default does not show icon toolbar

show_album_title

True

default does show album_title of album

sort_by

name

sorts images by the name further options are alias, date

reverse_sort

False

if set, the file list is sorted in reverse order

only_items

False

if set, only images which are described in listitem are shown

template_itemlist

False

if set, an item list is shown which could be copied into the wiki page

album

False

if set, selects album mode, only thumbnail from first image is shown, related is album title and album_image

album_overview

False

if set, a thumbnail overview will be created (see also target_page)

album_short_title

False

if set, the album_title is reduced that way that it fits in one line

album_title

unicode

default is pagename of the images for the album.

album_image

u''

image to show on album. default is the first image.

album_link_page

False

default links to slideshow, setting to True links to the page.

renew

False

if set then all selected thumbnails_* and webnails_* are removed and will be recreated

thumbnail_width

128

default width of thumbnail

webnail_width

640

default width of webnail

itemlist

  * [[image1.jpg|alias]]
  * [[image2.jpg|alias]]

Usage

Examples

one item to define an alias for an image

{{{
#!arnica
* [[100_1185.JPG| Bremen, SpaceCenter]]
}}}
Result

result1.png

only thumbnails, only_items text and date suppressed, tools shown

{{{
#!arnica show_text=0, show_date=0, show_tools=1, columns=2, only_items=1
 * [[100_1185.JPG| BremenSpaceCenter]]
 * [[100_1194.JPG| Bremen]]
}}}
Result

result2.png

only_items by two columns, date suppressed

{{{
#!arnica columns=2, only_items=1, show_date=0
 * [[100_1185.JPG| Bremen, SpaceCenter]]
 * [[100_1187.JPG| SpaceCenter, space suit]]
 * [[100_1194.JPG| Bremen behind SpaceCenter]]
}}}
Result

result3.png

file_regex used, date supressed, one column

{{{
#!arnica columns=1, file_regex=100_118[0-5], show_date=0
}}}
Result

result4.png

macro arnica

||<<arnica(album=1)>>||<<arnica(album=1, album_image=100_1194.JPG, album_title=Bremen)>>||
Result

result5.png

album overview for subpages

<<arnica(album=True,album_overview=True,album_link_page=True,sort_by=date, reverse_sort=True,show_text=False,show_album_title=True,thumbnail_width=175)>>
Result

result11.png

album overview for all pages with short title

<<arnica(album=True,album_overview=True,target_page=regex:title:ReimarBauer/HelpOnArnica,album_short_title=True,album_link_page=True,sort_by=date, reverse_sort=True,show_text=False,show_album_title=True,thumbnail_width=175)>> 
Result

result12.png

renew means always new thumbnails and webnails of selection

{{{
#!arnica only_items=1, show_date=0, show_tools=0, renew=1
 * [[100_1189.JPG | Bremen]]]
}}}
Result

result6.png

text and only_items and sort_by=alias

{{{
#!arnica show_text=1, show_date=0, columns=2, only_items=1, sort_by=alias
 * [[100_1185.JPG| Bremen, SpaceCenter]]
 * [[100_1194.JPG| Bremen]]
}}}
Result

result7.png

text and only_items and sort_by=date, reverse order

{{{
#!arnica show_text=1, show_date=1, columns=2, only_items=1, sort_by=date, reverse_sort=1
 * [[100_1185.JPG| Bremen, SpaceCenter]]
 * [[100_1194.JPG| Bremen]]
}}}
Result

result8.png

template itemlist

{{{
#!arnica template_itemlist=True
}}}
Result

Copy the following listitems into the script. Replace alias with the label you want. Afterwards disable template_itemlist by setting it to False:

result9.png

slide show

When you click on the slide show icon or an thumbnail the arnica_slides action is called.

result10.png

Discussion

Hi Reimar, I'm trying to run MoinMoin and arnica on OSX. I've installed pillow instead of PIL, and arnica generates thumbnails fine but when I click a thumbnail to go slideshow it shows this error "The action arnica_slides needs Python Imaging Library (PIL) installed". Isn't PIL/pillow working if thumbnails are generated? Thanks, -- TakeoKatsuki 2015-10-07 22:47:56

Hi, thanks for this useful extension. I am beginning to use it, and it seems to work well for a small set of pictures, but have encountered some problems when the set is large. Some thumbnail messages show "submit" labels without showing any thumbnail images. Some images do not appear at all in the slide show. I have about 70 fairly large images in a page -- this is what I mean by a large set. Perhaps this is too much for arnica to handle? On the other hand, with a digital camera of these days, this can be a typical day's work on vacation. Or, perhaps I need to tweak some parameters so that the server can handle thumbnail/webnail requests better? Any hints? Thanks -- Sam, 2011-06-20

Is there a way to maintain arnica cache longer? arnica in my environment seems to need to refresh cache every few months. With a few hundred images in a page, thumbnail creation takes very long. My environment is Ubuntu Linux Server on Windows 7 with Virtual Box (Windows is host and Ubuntu is guest). -- TakeoKatsuki 2012-08-09 16:57:20

That is a different question as I might have answered on your homepage. I have yet not seen this cache issue. I look on my server tom. One reason for updates for the cache is also a python upgrade to a newer version. It should not be needed to refresh the cache on Posix systems.

It would be nice if one can add a comment/legend to each picture. -- TakeoKatsuki 2012-09-25 20:50:36

Previous Discussion

see /Discussion

Bugs

Please enter bug reports on our issue tracker for moin1-extensions https://bitbucket.org/ReimarBauer/moin1-extensions/issues

Before 2012-03-10

With MoinMoin 1.9.3 on an Ubuntu Server, clicking the slide show icon of the tool returns internal server error. -- TakeoKatsuki 2010-10-16 01:40:21

Please provide the traceback, look into the stderr log for e.g. apache, add it here and we probably can help.

This issue is solved. Download the plugin again. -- DirkAlders 2012-02-11 20:54:17

Preview Leads to an TypeError

We found an little error with latest moinmoin 1.9.x and the current arnica parser. But only if you add the macro  <<arnica>>  and have no images uploaded (btw. the parser syntax works, only macro call not). The problem occurs only if you press the preview function in the editor. If you save the page and see it in "normal mode", you will see a text like: "No matching image file found!None " (see the none; after the message). Here is my traceback. -- MarcelHäfner 2011-08-30 15:01:20

2011-08-30 16:53:13,308 MoinMoin.wsgiapp ERROR An exception has occurred [http://informatik/Test].
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/MoinMoin/wsgiapp.py", line 282, in __call__
    response = run(context)
  File "/usr/lib/python2.5/site-packages/MoinMoin/wsgiapp.py", line 88, in run
    response = dispatch(request, context, action_name)
  File "/usr/lib/python2.5/site-packages/MoinMoin/wsgiapp.py", line 136, in dispatch
    response = handle_action(context, pagename, action_name)
  File "/usr/lib/python2.5/site-packages/MoinMoin/wsgiapp.py", line 195, in handle_action
    handler(context.page.page_name, context)
  File "/usr/lib/python2.5/site-packages/MoinMoin/action/edit.py", line 152, in execute
    pg.sendEditor(preview=savetext, comment=comment)
  File "/usr/lib/python2.5/site-packages/MoinMoin/PageEditor.py", line 511, in sendEditor
    self.send_page(content_id=content_id, content_only=1, hilite_re=badwords_re)
  File "/usr/lib/python2.5/site-packages/MoinMoin/Page.py", line 1198, in send_page
    start_line=pi['lines'])
  File "/usr/lib/python2.5/site-packages/MoinMoin/Page.py", line 1288, in send_page_content
    self.format(parser)
  File "/usr/lib/python2.5/site-packages/MoinMoin/Page.py", line 1309, in format
    parser.format(self.formatter)
  File "/usr/lib/python2.5/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1554, in format
    formatted_line = self.scan(line, inhibit_p=inhibit_p)
  File "/usr/lib/python2.5/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1364, in scan
    result.append(self.replace(match, inhibit_p))
  File "/usr/lib/python2.5/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1409, in replace
    return ''.join(result)
TypeError: sequence item 0: expected string, NoneType found

/!\ I can't reproduce with changeset 581:374033c4eb26, If it still happens in your setup please file it again to the tracker, see above -- ReimarBauer 2012-03-10 18:51:12

The Navigation-Buttons (see image) are not working (clickable) under Google Chrome (Windows).

google-chrome-navigation-not-working.png

The original Slideshow (http://www.ricocheting.com/static/code/javascript/example-slideshow_v1.html) is working. With Firefox everything is fine!

bye -- MarcelHäfner 2011-08-31 09:51:29

(!) Fixed by https://bitbucket.org/ReimarBauer/moin1-extensions/changeset/704cc7c29b9b

Exif is not read

Hi Reimar, date shown is not from Exif but from the date of attachment. MoinMoin 1.9.3 on an Ubuntu Server. Thanks. -- TakeoKatsuki 2011-11-28 02:25:51

That happens if there is no exif also, so I need a test.jpg to verify. -- ReimarBauer 2011-11-28 12:41:01

If you know how we can get that timestamp using python I can add it.

Possibly you rotated the picture, I recognised, that after rotating a picture the Exif-Information is Lost. -- DirkAlders 2012-01-08 13:14:37

MoinMoin: ReimarBauer/HelpOnArnica (last edited 2015-10-07 22:47:57 by TakeoKatsuki)