Re: img issue: should we restrict the URI

On Tue, Jul 29, 2008 at 9:14 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Thu, 24 Jan 2008, Jeff Schiller wrote:
> >
> > http://www.w3.org/TR/html5/#the-img has an issue highlighted:  "Should
> > we restrict the URI to pointing to an image? What's an image? Is PDF an
> > image? (Safari supports PDFs in <img> elements.) How about SVG? (Opera
> > supports those). WMFs? XPMs? HTML?"
> >
> > My belief is that we should not restrict the URI or specify the format.
>
> So should UAs support text/plain and text/html resources in <img>
> elements?
>

First - I do not think we should restrict the URI.  For example
http://www.example.com/foo.php could return image/png.  Originally, I
thought maybe the idea was to restrict the URIs to some predefined set of
file prefixes (.png, .gif, .jpg, etc) - but I then realized that it was
asking the question of whether the resource that the URI points to should be
of a certain list of types.

I still don't like the idea of only a certain set of types as it is isn't
forward-looking and it requires drawing some lines in the sand and say this
type is 'blessed' and this type is not.

One simple option would be to state that the (proposed) MIME type of the
resource must begin with "image/".  If that, for some reason, is not
sufficient then I think we have to go deeper and figure out what the purpose
of a html:img element is.

I struggled a little bit with the defintiion of an 'image' from an HTML
perspective.  I think the best one I can muster is:

The purpose of an image is to display a visual, non-interactive
representation that cannot be sufficiently achieved through other markup
(such as text, hyperlink or table).

Might get some accessibility folks angry because this automatically means
the 'alt' text of an image is an inferior representation - but I think
that's just the cruel fact.

Anyway, with the above definition of an image, I think it would be
sufficient to say:

"If the UA understands how to treat the resource as an image, then this is
sufficient for the UA to render it, otherwise the alt text shall be used."

This would rule out things like text and HTML since, by definition, those
things are not images.

However, if someone sees a reason why it would be good to treat text/html as
an image, please elaborate.

Finally, I also think that some guidelines should be defined for how certain
resources are treated as images vs. embedded content.  That's the reason I
include 'non-interactive' in my definition above and we need to define what
that means.  Of course I'm coming from the SVG angle here since UAs are
right now trying to figure out the rules for how they will treat SVG when
included as an img vs. as an object/embed/iframe.

Regards,
Jeff Schiller

Received on Wednesday, 30 July 2008 03:37:51 UTC