On Thu, Apr 16, 2009 at 9:35 PM, Sergiu Dumitriu <[email protected]> wrote:
Vincent Massol wrote:
On Apr 16, 2009, at 5:18 PM, Guillaume Lerouge wrote:
Hi,
On Thu, Apr 16, 2009 at 5:09 PM, Asiri Rathnayake < [email protected]> wrote:
Hi Anca,
a --> href, name
img --> alt, src td --> colspan, rowspan
I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO). Why were you removing those in the first place?
We wanted to keep the generated wiki content as clean as possible (it's not about valid / invalid xhtml). This means avoid (%%) elements in xwiki 2.0 syntax whenever we can.
and they're quite important attributes of an image, because of this size
issue.
Thus we need to add them back ;) Well, there's another option that might work. If we want to do both things:
1. Remove as many style attributes as we can in filtered mode to keep the wiki syntax output clean 2. While preventing huge images to be displayed on the screen
we could add a post-treatment filter on images: if a given image is, say, wider than 800px / higher than 600px its max dimension gets resized to that height / width. This way we keep the syntax clean & uncluttered while outputting an image that will display well on most screens / most configuration.
I'd prefer instead to leave the width/height params only when they are required but I don't think it's very easy to do since you need to know the image native width/height (same problem with your suggestion).
Apache xmlgraphics allows to retrieve these without loading all the image in memory.
I think you are referring to http://xmlgraphics.apache.org/commons/image-loader.html However I don't like mixing up image loading and html cleaning code together. I mean currently html filters are designed to manipulate html documents, they should not worry about reading images and finding out their dimensions. What we can do is allow height & width attributes and do a post filtering operation (on XDOM) that rips off the height & width attributes where they are not necessary. I'm going to add heigh & width attributes into the allowed attributes list for the moment and later I will work on filtering the xdom by ripping off these attributes where necessary (by sing xmlgraphics). I will mention this on the JIRA and keep it open until it's done. Thanks. - Asiri