Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-7768

XWiki.LiveTableResultsMacros _images column includes unscaled thumbnails with <img> having width set to 50

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5
    • Fix Version/s: 4.0
    • Component/s: LiveTable
    • Labels:
      None
    • keywords:
      livetable _images thumbnails not scaled
    • Difficulty:
      Trivial
    • Similar issues:

      Description

      In the XWiki.LiveTableResultsMacros code the width for the image is set to 50px,
      however the source image url does not include the ?width=50 parameter to the scale the image attachment, which wastes bandwidth with large attachments.

      #**
       * List image attachments for a document, putting the result as HTML markup in the $imagesList variable.
       *#
      #macro(livetable_getImagesList $itemDoc)
        #set($imagesList = '')
        #foreach ($attachment in $itemDoc.attachmentList)
          #if($attachment.isImage())
            #set($attachmentUrl = $itemDoc.getAttachmentURL($attachment.filename))
            #set($imagesList = "${imagesList}<img src='${attachmentUrl}' alt='${attachment.filename}' width='50'/><br/>")
          #end
        #end
      #end
      

      Could this be updated to scale the images server side?

      #set($imagesList = "${imagesList}<img src='${attachmentUrl}?width=50' alt='${attachment.filename}' width='50'/><br/>")
      

        Attachments

          Activity

            People

            • Assignee:
              mflorea Marius Dumitru Florea
              Reporter:
              jamiem Jamie Maher
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: