W3C home > Mailing lists > Public > www-talk@w3.org > July to August 2003

Re: HTML Keep IMAGE Ratio

From: Reinier Post <rp@win.tue.nl>
Date: Tue, 29 Jul 2003 13:31:34 +0200
To: www-talk@w3.org
Message-ID: <20030729133134.C11315@gazelle.win.tue.nl>

On Wed, Jul 16, 2003 at 10:22:10AM -0400, John Manko wrote:
> 
> KEEP IMAGE RATIO
> Ok, I'm surprised that this is not taken care of with HTML.
 
Yes, I have also run into this problem.  But I solve it by preprocessing.

> I propose the following standard (but also looking for a
> PHP workaround if available) for the Img HTML tag:
> 
> RATIO = Keep|Ignore, default Ignore
> 
> &lt; img width='x' height='y' RATIO='Keep|Ignore' &gt;
> 
> Where, RATIO=Keep will inlarge the image to a
> max WIDTH or HEIGHT (which ever comes first),
> without changing the perspective ratio.

RATIO=Ignore is equivalent to omitting it altogether.
With RATIO=Keep you suggest it should use the maximum size
that will fit.  But that will give you issues with alignment,
I think.

[...]

> consider this:
> Image1 : 100x100  (Ratio = 1:1)
> Image2 : 100x200  (Ratio = 1:2)
> 
> Space available for display : 75x75

[...]

> Case3:
> Just specify EITHER width=75 OR heigth=75, but how
> will I know which one to specify without coding for it?
> For every image I have to check this!

True.  Often you are already doing some proprocessing anyway (e.g.
to generate smaller thumbnail images, or to compute other proportions based
on the resulting image size), so it isn't a big deal.  An alternative
is to do it with Javascript.  If neither of these apply you have a point.
But I wonder if the pain of having to support this is worth the gain
of being able to use it.

-- 
Reinier
Received on Tuesday, 29 July 2003 07:31:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:28 GMT