471,627 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

proportional resize with maximum height and maximum width.

hello,
is it possible to resize an image with same proportion.
having a maximum height and a maximum width.

the solution should work on main browsers (do not use max-height and
max-width).

or should i do it with javascript?

Nov 3 '07 #1
3 8752
In article
<11*********************@o3g2000hsb.googlegroups.c om>,
Jean-Sébastien <je***************@gmail.comwrote:
is it possible to resize an image with same proportion.
having a maximum height and a maximum width.
The question as a whole makes no sense.

If you want an image to resize with a container and be in some
proportion, then you can size the container in % terms and also
the image in css to be 100% wide and high inside that container.

--
dorayme
Nov 3 '07 #2
On 2007-11-03, dorayme <do************@optusnet.com.auwrote:
In article
<11*********************@o3g2000hsb.googlegroups. com>,
Jean-Sébastien <je***************@gmail.comwrote:
>is it possible to resize an image with same proportion.
having a maximum height and a maximum width.

The question as a whole makes no sense.
Well you could read it as requiring all three things: allow any resize
operation that doesn't exceed max height, that also doesn't exceed max
width, and that also preserves aspect ratio.

I don't think that's exactly what the spec gives you unfortunately. It
tries to keep aspect ratio as close as possible to the intrinsic aspect
ratio subject to the min/max constraints. But it doesn't treat aspect
ratio itself as a constraint, so you can end up hitting max-width and
max-height with the wrong aspect ratio.

OP should study the table at

http://www.w3.org/TR/CSS21/visudet.html#min-max-widths
Nov 3 '07 #3
Jean-Sébastien wrote:
>
is it possible to resize an image with same proportion.
having a maximum height and a maximum width.
Not with just CSS. You can't confine the dimensions independently of
each other and not have it skew.
or should i do it with javascript?
Depends on what you're doing with these images. If it's something like a
photo gallery, it might be better to do it server side with something
like ImageMagick.

--
Berg
Nov 3 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by David Hayes | last post: by
2 posts views Thread by DraguVaso | last post: by
3 posts views Thread by john andrew | last post: by
6 posts views Thread by Rob | last post: by
6 posts views Thread by evolozik | last post: by
4 posts views Thread by Rob | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.