• Dmitry Bakbardin
    Dmitry Bakbardin, 2011/09/16 07:29

    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.

    • Bernhard Hopf
      Bernhard Hopf, 2011/09/17 14:37

      I have corrected this in version 1.1
      Thanks for the info and code!

      • Vincent Massol
        Vincent Massol, 2011/10/17 17:31

        BTW for the record, this issue with relative images has been fixed in recent version of XWiki Enterprise.

  • Vincent Massol
    Vincent Massol, 2011/09/18 08:37

    Bernard, when you add a new version please:

    • 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
    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
    {{photoalbum DefaultImageSize="800" ImageSizeList="-" Sort="no"/}}

    Maybe you can update the official version to include it

    #set($list = $xwiki.getArrayList())
    #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:[email protected]$attach.filename||#if($request.ImageSize!="original")width="$ImageSize"#end]]
    #end
    {{/gallery}}

    ----

    #foreach( $item in $sortedList ) #set($attachment = $map.get($item)) [[[[image:[email protected]$attachment.getFilename()#if($request.ThumbSize!="original")||width="$ThumbSize"#end]]>>attach:[email protected]$attachment.getFilename()]]#end
    • Bernhard Hopf
      Bernhard Hopf, 2012/06/29 21:07

      Thanks for your suggestion. I have modified the macro and now you can sort on name, type, size, date.

      {{photoalbum DefaultImageSize="800" ImageSizeList="-" Sort="name"/}}
  • Gonzalo Jara
    Gonzalo Jara, 2016/12/12 20:18

    Hello! Is this macro still working in 2016? I installed it via the extension manager, but after adding Unknown macro: photoalbum. nothing happens, even though i have images attached to the document.

Get Connected