![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Do you know if it is possible to have an image to be scalled to a maximum width/height, but with keeping its aspect ratio. |
#3
| |||
| |||
|
|
Do you know if it is possible to have an image to be scalled to a maximum width/height, but with keeping its aspect ratio. |
#4
| |||
| |||
|
|
Do you know if it is possible to have an image to be scalled to a maximum width/height, but with keeping its aspect ratio. The two ideas I had were: - <img src="toto.jpg" style="max-width: 200px; max-height: 200px;"/ but it doesn't keep the ratio - <div style="width: 200px; height: 200px;"><img src="toto.jpg/></div but the image flow outside the div Sincerly, img src="toto.jpg" width="100%" |
#5
| |||
| |||
|
|
Stephane D'Alu <sdalu (AT) sdalu (DOT) com> wrote: Do you know if it is possible to have an image to be scalled to a maximum width/height, but with keeping its aspect ratio. Maximum with respect to what? You can set width: 100%, and by leaving height unset, you're asking browsers to maintain the proportions. |
#6
| |||
| |||
|
|
I want to be able to specify the maximum width AND height of a block and have the image fitting in it but keeping its aspect ratio |
|
(in fact an easy way to create a thumbnail gallery in a browser). |
|
And of course the size is specified in px, em or ex, but not a percentage. |
#7
| |||
| |||
|
|
Stephane D'Alu <sdalu (AT) sdalu (DOT) com> wrote: Do you know if it is possible to have an image to be scalled to a maximum width/height, but with keeping its aspect ratio. Maximum with respect to what? You can set width: 100%, and by leaving height unset, you're asking browsers to maintain the proportions. But browsers generally do an awful job in scaling images. Anything but a very simple ornament probably gets distorted. Actually, I find that most browsers (IE/Mozilla/Netscape/Opera) do quite |
#8
| |||
| |||
|
|
Do you know if it is possible to have an image to be scalled to a maximum width/height, but with keeping its aspect ratio. |
#9
| |||
| |||
|
|
Actually, I find that most browsers (IE/Mozilla/Netscape/Opera) do quite a good job of re-scaling the image downwards (i.e. automatic 'down sampling'). The secret seems to be to produce the image big enough so that, for most common browser size settings, the browser is *always* re-sampling downwards. The larger size of the image means that the compression need to be higher, and so the image is probably not quite as good as a fixed-sized one -- but it's really not too bad at all for all practical purposes. It works well with flexible pages, so that as the screen shrinks, the image shrinks to maintain the same proportion (which may or may not be a good thing, depending upon what your aiming for). |
#10
| |||
| |||
|
|
jake <jake (AT) gododdin (DOT) demon.co.uk> wrote in news:KtbknkYR4xk$Ew3+@gododdin.demon.co.uk: Actually, I find that most browsers (IE/Mozilla/Netscape/Opera) do quite a good job of re-scaling the image downwards (i.e. automatic 'down sampling'). |
|
It should not, however, be used to create thumbnails. |
![]() |
| Thread Tools | |
| Display Modes | |
| |