I tried to use macro by using it inside ClassSheet page. It's not working correctly. Links to attachments are broken. If you add a bit code in three places in Macro code:
...image:$doc@$attachment...
instead of
...image:$attachment...
It would work fine! Without $doc it looks for attacment in ClassSheet Page instead of the current page. Thanks.
BernhardH, 2011/09/17 14:37
I have corrected this in version 1.1 Thanks for the info and code!
Don't remove the previous one since you're breaking the ability to download past versions
Add a version object as mentioned in the edit instructions when you edit the page. This is needed to make your new version available
JamieMaher, 2012/03/29 23:47
I modified the 1.1 PhotoAlbum Macro to default to sorting the image attachments for the page by the filename. You can also turn off sorting by including Sort="no" in the macro parameters (optional).
I tested this against XWiki Enterprise 3.5
eg. Turn off sorting {{photoalbumDefaultImageSize="800"ImageSizeList="-"Sort="no"/}}
Maybe you can update the official version to include it
Hello! Is this macro still working in 2016? I installed it via the extension manager, but after adding Unknown macro: photoalbum. Click on this message for details. The [photoalbum] macro is not in the list of registered macros. Verify the spelling or contact your administrator. nothing happens, even though i have images attached to the document.
I tried to use macro by using it inside ClassSheet page. It's not working correctly. Links to attachments are broken.
If you add a bit code in three places in Macro code:
...image:$doc@$attachment...
instead of
...image:$attachment...
It would work fine!
Without $doc it looks for attacment in ClassSheet Page instead of the current page.
Thanks.
I have corrected this in version 1.1
Thanks for the info and code!
BTW for the record, this issue with relative images has been fixed in recent version of XWiki Enterprise.
Bernard, when you add a new version please:
I modified the 1.1 PhotoAlbum Macro to default to sorting the image attachments for the page by the filename.
You can also turn off sorting by including Sort="no" in the macro parameters (optional).
I tested this against XWiki Enterprise 3.5
eg. Turn off sorting
{{photoalbum DefaultImageSize="800" ImageSizeList="-" Sort="no"/}}
Maybe you can update the official version to include it
#set($map = $xwiki.getHashMap())
#foreach($attach in $doc.attachmentList)
#if($attach.isImage())
#set($name = $attach.getFilename())
#set($ok = $list.add($name))
#set($ok = $map.put($name, $attach))
#end
#end
#set($sort = "$!context.macro.params.Sort")
#if( $sort != "no" )
#set($sortedList = $util.sort($list))
#else
#set($sortedList = $list)
#end
{{gallery}}
#foreach($item in $sortedList)
#set($attach = $map.get($item))
[[image:$doc@$attach.filename||#if($request.ImageSize!="original")width="$ImageSize"#end]]
#end
{{/gallery}}
----
#foreach( $item in $sortedList ) #set($attachment = $map.get($item)) [[[[image:$doc@$attachment.getFilename()#if($request.ThumbSize!="original")||width="$ThumbSize"#end]]>>attach:$doc@$attachment.getFilename()]]#end
Thanks for your suggestion. I have modified the macro and now you can sort on name, type, size, date.
Hello! Is this macro still working in 2016? I installed it via the extension manager, but after adding Unknown macro: photoalbum. Click on this message for details.
The [photoalbum] macro is not in the list of registered macros. Verify the spelling or contact your administrator.
nothing happens, even though i have images attached to the document.