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.
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
Of course, can easily be changed - but those do their own thumbnails, so it's unlikely someone will use both at the same time (I assume). The reason I didn't try out Gallery/Gallery2 is that I was somewhat afraid of the dependencies (and I can't install anything on my moin server). In fact, once I had written Thumbnail.py, it turned out not even PIL was available, so I even had to work around that.. -- Allefant 2006-09-24 19:09:01
- If you don't change your thumbnails name a user of Gallery2 will become webnails and thumbnails again duplicated and that's not very usefull. For Gallery2 I would prefer a name like tmp.thumbnail_image.png.
If that file exists Gallery2 will use it and all is perfect. If they do start with tmp. they will be ignored and from them no thumbnails or webnails will be created. -- ReimarBauer 2006-09-24 20:47:48
Ok, now they are named tmp.size.base.jpg. -- Allefant 2006-09-24 21:22:41
- If you don't change your thumbnails name a user of Gallery2 will become webnails and thumbnails again duplicated and that's not very usefull. For Gallery2 I would prefer a name like tmp.thumbnail_image.png.