Comments on Gallery Macro
Last modified by Thomas Mortagne on 2023/10/10 16:20
Choose the export format from the list below:
Export as Portable Document Format (PDF) using the Web Browser
Export as HyperText Markup Language (HTML)
Could it be extended to slide show of wiki pages?
Not easily. The gallery macro doesn't do much: it just wraps the macro content with a DIV that has the "gallery" CSS class. All the logic is in the JavaScript code, which collects all the images from the macro output. Unless you find a way to "export" a wiki page as an image you can't use the gallery macro to view wiki pages.
Generally speaking, creating a slide show of wiki pages without using images (generated screenshots) or an IFRAME element is hard to do because you have to handle the interference between the page that hosts the slide show and the pages that are displayed in the slide show (HTML, CSS and JavaScript interference).
Any chance of extending this so that you could show a footnote for each image? Perhaps use the alt text as the footnote. My thinking is using the gallery as part of a step-by-step tutorial where you flip between the images and the footnotes describes what you should be doing. This would make the images more meaningful rather than a beauty pass gallery (which looks great by the way).
I guess something like:
{{gallery}}
image:iphone.safari.settings.png||alt="Open the settings page for Safari"
image:iphone.safari.setting.cookies.png||alt="Ensure that Javascript is turned on and Cookies is set to From Visited"
{{/gallery}}
I am looking at using XWiki for our Documentation and am enjoying it so far.
This is a very good idea. You should open a feature request in JIRA ( https://jira.xwiki.org/browse/XWIKI/component/11191 ).
Thanks Marius, added (https://jira.xwiki.org/browse/XWIKI-6762). LOL it's probably not a Major priority for others, but it is for me
Hopefully someone can whip this baby up for me.
Is there any way of specifying the width of the gallery container?
Currently no. The width and height of the gallery container is computed from the image max width/height, which are hard-coded in resources/uicomponents/widgets/gallery/gallery.css . I could add a maxWidth and maxHeight parameters to the gallery macro, and pass them to the gallery.css in the URL. Can you open a JIRA issue for this too? Thanks.
FTR I've opened https://jira.xwiki.org/browse/XWIKI-13718
I failed to run macro with abovementioned code
{{gallery}}
#foreach($attachment in $doc.attachmentList)
#if($attachment.isImage())
image:$attachment.filename
#end
#end
{{/gallery}}
{{/velocity}}
Some modifications made it workable for me.
{{gallery}}
#foreach($attachment in $doc.attachmentList)
#if($attachment.isImage())
[[image:$doc@$attachment.filename]]
#end
#end
{{/gallery}}
{{/velocity}}
Dmitry, I've tried the script again and it works fine for me. The version you wrote just makes the image link absolute. We had a bug fixed in recent version of XE when including a page that has relative links/images. Maybe you hit it.