MrBertie/pagequery — pull request #25 by mightymt (2014-03-01 14:39:20+00:00)
Title: Thumbnail feature

Hello Symon,

A few weeks ago I took the time to look into the thumbnail (i.e. first image in page) feature for pagequery. This was the single feature I missed most in pagequery and I noticed that it had also been requested by someone else on the plugin discussions page.

So I added a new option called **thumbnail** which accepts a maximum of two optional comma separated parameters:
* One parameter defines the desired **image size** and can either be a number (defining just the width) or two numbers separated by the letter x (defining width and height) just like DokuWiki’s image syntax. If omitted, the image will be displayed with a width of 100 pixels and automatic height. In case the user gives a size of 0 or 0x0 the image will be displayed in **full size** (I don’t know how useful this is but some users may want this).
* The other parameter can be either **center**, **left** or **right** and defines the desired **alignment** of the image. If omitted, no alignment is used and the image will be displayed inline.

A few more notes:

* The URL of the image is taken from the page’s metadata field relation→firstimage.
* The thumbnail option has no effect whatsoever on the output of the “main” link as configured by the display option.
* The thumbnail image will always be displayed immediately after the opening li-Tag and before the “main” link. Also it will always be wrapped in a link itself because the html_wikilink function is used to output the image.
* Works with internal and external images (although cropping of external images may not work depending on the DokuWiki and server configuration).

I hope you can merge this into pagequery in one form or another so other people can benefit from it as well. If you have any ideas about changes or improvements of this implementation I’d be happy to help.

Kind regards,
Thomas