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

HTML Keep IMAGE Ratio

From: John Manko <xerid@adelphia.net>
Date: Wed, 16 Jul 2003 10:22:10 -0400
Message-ID: <3F155F92.2030102@adelphia.net>
To: www-talk@w3.org

KEEP IMAGE RATIO
Ok, I'm surprised that this is not taken care of with HTML.

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.

I don't want to have to use Photoshop or Gimp to
ensure that the images a width=x or heigth=y will keep ratio.

Before you go responding with percentages, I should note this.

consider this:
Image1 : 100x100  (Ratio = 1:1)
Image2 : 100x200  (Ratio = 1:2)

Space available for display : 75x75

Case 1:
I can say "width=75%  height=75%", but this will
only work for Image1, since Image2 will end up
as 75x150 (which clearly does not fit the 75x75 constraints)

Case 2:
If I specify "width=75  height=75",
again, this works for Image1, but
not Image2, since the new Image2 ratio will be 1:1,
with Image2 losing 1/2 of it's heigth ratio.

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!

Case 4:
specify "img width='75' height='75' RATIO='Keep'"
Results:
Image1 :  75x75 : RATIO 1:1
Image2 :  38x75 (37.5x75): RATIO 1:2
all is good and merry

Thanks,
John
Received on Wednesday, 16 July 2003 10:23:01 GMT

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