Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnail feature #25

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Thumbnail feature #25

wants to merge 8 commits into from

Conversation

mightymt
Copy link

@mightymt mightymt commented Mar 1, 2014

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

FIX: Invalid HTML output when using "snippet=plain" or "snippet=quoted"
Implemented thumbnail feature with image alignment options like in DokuWiki image syntax. Only works for right alignment.
Changed default thumbnail size to 100px in width with auto height

Allows full size images when the user specifies either "0" or "0x0" as image size

The "current" class is now added to the list item of the currently viewed page. This is usefull for CSS styling when pagequery is used in the sidebar.
Previously thumbnails were always displayed, even if the "thumbnail" option wasn't given at all.
@MrBertie
Copy link
Owner

MrBertie commented Mar 7, 2014

Sorry I haven't got back to you on this; been rather busy at work. First, thank you much for all the hard work on this addition. I'll try to get some time this weekend to revie wit and see if it can get it merged into the master. Tx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants