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

Control avatar size when uploaded

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Duplicate
    • Major
    • None
    • 2.6.1
    • Model
    • Medium
    • Awaiting Pull Request creation

    Description

      Hi guys,

      We needed to have a check on the size of avatars uploaded by users. It was as a TODO in the changeavatar.vm
      so I follow you my implementation.

      Modified classes are based on 2.6 of xwiki-core.jar :
      com.xpn.xwiki.doc.XWikiAttachment
      com.xpn.xwiki.api.Attachment

      Modified template is based on 2.6 too :
      changeavatar.vm

      A basic ImageInfo object (inner class in XWikiAttachment, get images properties with javax.imageio)
      is singletoned in XWikiAttachement. It is made availlable from templates via api.Atttachment

      Note that in changeavatar.vm, error messages and max dimensions are hardcoded and tha the redirection if picture too big is done upon javascript

      Attachments

        1. Attachment.java
          6 kB
          Goulven Furet
        2. changeavatar.vm
          1 kB
          Goulven Furet
        3. XWikiAttachment.java
          25 kB
          Goulven Furet

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              goulven Goulven Furet
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: