Thumbnails

Description

This is a very simple action (well, the first version was, *sigh*) to create thumbnail images for the attachments on the page.

It adds four configuration settings (with default values given below):

thumbextensions = ["png", "jpg", "gif"]
thumbsizes = [160, 320, 640]
thumbname = "tmp.%(size)s.%(base)s.jpg"
thumbignore = ["^tmp\\..*"]

On running the action, all attachements with one of the extensions in thumbextensions are converted into thumbnail image in the sizes listed in thumbsizes, with the name as specified by thumbname, and added as a new attachment, in JPG format. Existing thumbnails are replaced, and no thumbnails are made for files matching any of the thumbignore regular expressions.

The action uses either the PIL module or ImageMagick tools to do its work.

To use, simply drop the following script into your plugin/action folder.

Thumbnails.py

Discussions

I do prefer to add a prefix of the name 'tmp.' to the names, so these files could be automaticly ignored by the ParserMarket/Gallery2 parser and the MacroMarket/Gallery macro. (Or on the other hand could be used by them.) -- ReimarBauer 2006-09-23 11:28:22

MoinMoin: ActionMarket/Thumbnails (last edited 2008-01-20 19:48:32 by adsl-76-227-16-215)