|
Posted by no-spam on March 29, 2005, 6:56 pm
Please log in for more thread options
Hello,
I have an HTML question that I'm not sure can be solved. I want to
restrict the maximum size of an inline image.
For example, I can force the image to be 200x200 if I do this:
<img src=blah.gif width=200 height=200>
But, that messes up the aspect ratio, and could size the image larger than
it's original size.
What I want is a way to size an image such that it's aspect ratio is
preserved and the image is less than the given size (let's say 200x200 for
now).
I've tried placing the image in a table cell, and setting the table cell
size to 200x200, but that doesn't work as the image displays in full size
(stretching the table cell beyond that I specified)
Yes, I know I can do this by manually resizing the image, or fetching the
dimensions of the image and calculating a size myself. But, I am
specifically looking for a way to do it with an inlime image without
fetching it first.
Thanks
-----------------------------------------------------------
> Posted using QuadSucker/News, http://www.quadsucker.com > ... the ultimate tool for newsgroup downloading!
-----------------------------------------------------------
|
|
Posted by jake on March 29, 2005, 8:51 pm
Please log in for more thread options
writes
>Hello,
>
>I have an HTML question that I'm not sure can be solved. I want to
>restrict the maximum size of an inline image.
>
>For example, I can force the image to be 200x200 if I do this:
><img src=blah.gif width=200 height=200>
>
>But, that messes up the aspect ratio, and could size the image larger than
>it's original size.
>
>What I want is a way to size an image such that it's aspect ratio is
>preserved and the image is less than the given size (let's say 200x200 for
>now).
>
>I've tried placing the image in a table cell, and setting the table cell
>size to 200x200, but that doesn't work as the image displays in full size
>(stretching the table cell beyond that I specified)
>
>Yes, I know I can do this by manually resizing the image, or fetching the
>dimensions of the image and calculating a size myself. But, I am
>specifically looking for a way to do it with an inlime image without
>fetching it first.
>
>Thanks
>
>-----------------------------------------------------------
>> Posted using QuadSucker/News, http://www.quadsucker.com >> ... the ultimate tool for newsgroup downloading!
>-----------------------------------------------------------
(a) Place the image in a containing DIV which you set to the appropriate
width (say 200px).
(b) Then set the <img> size as: width="100%'
That will cause the browser to resize the image and display it as 200px
wide.
Depending on what you are trying to do, resizing the image in an image
editor beforehand is usually the best approach.
What are you trying to do?
regards.
--
Jake
|
|
Posted by Stan Brown on March 31, 2005, 2:30 am
Please log in for more thread options
"" wrote in comp.infosystems.www.authoring.html:
>What I want is a way to size an image such that it's aspect ratio is
>preserved and the image is less than the given size (let's say 200x200 for
>now).
Then you want an image processor, such as the free Irfanview (if
you're on Windows, which I imagine you are):
http://www.irfanview.com/
Do not, repeat not, resize images in HTML. First, mst browsers do a
poorer job than most image processors. Second, it's pretty silly to
download a big image and then display it as a small image.
--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
|
| Similar Threads | Posted | | Re: Restricting inline image size | March 29, 2005, 9:24 pm |
| Re: Restricting inline image size | March 30, 2005, 2:07 am |
| Inline-Element with higher font-size inside A: Hover about full height? | November 21, 2006, 7:55 pm |
| fixed image size | February 12, 2007, 1:53 pm |
| Display larger size image | August 6, 2004, 11:56 pm |
| client-side image size changing question | June 22, 2005, 6:26 am |
| restricting width of div | October 20, 2004, 8:06 am |
| Firefox - Prevent TextField size change when user changes font size? | October 3, 2006, 6:21 pm |
| Creating image maps with Adobe Illustrator or Image Ready. | March 8, 2005, 12:42 pm |
| How to lauch an image editor when click on an image link ? | November 8, 2004, 7:00 am |
|