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 :
Modified template is based on 2.6 too :
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