Resize image dynamically

M

Michael Laplante

Is there a way to re-size an image when a user re-sizes their window so that
resizes proportionately?

I've seen this done before but I think in that case, the image was set as a
background image for the page. I want to display a "photoalbum" where the
image resizes proportionately. My gut feeling is that it can't be done but
maybe somebody knows different?

Also, I would prefer to accomplish it without scripts.

M
 
B

Benjamin Niemann

Michael said:
Is there a way to re-size an image when a user re-sizes their window so
that resizes proportionately?

I've seen this done before but I think in that case, the image was set as
a background image for the page. I want to display a "photoalbum" where
the image resizes proportionately. My gut feeling is that it can't be done
but maybe somebody knows different?

Also, I would prefer to accomplish it without scripts.

You can specify the image size in % via CSS (WIDTH and HEIGHT attributes for
the IMG element are always in px).

I would not recommend to do so though. Scaling algorithms of browsers are
usually a PITA and anything except the unscaled image looks like crap.

BTW: Scaling background images is not yet possible. It will come with CSS3
and some browsers may even implement it (or have a similar proprietary
extension of their own), but CSS3 is still draft and details may change.
 
M

Michael Laplante

Benjamin Niemann said:
Michael Laplante wrote:
You can specify the image size in % via CSS (WIDTH and HEIGHT attributes
for
the IMG element are always in px).

Is that percentage of the screen size or percentage of the original image
dimensions?
I would not recommend to do so though. Scaling algorithms of browsers are
usually a PITA and anything except the unscaled image looks like crap.

Shouldn't matter to me. This is only for a pages on my hard drive. As long
as MY browser (FF) renders it okay. . .

M
 
D

dorayme

Michael Laplante said:
Is that percentage of the screen size or percentage of the original image
dimensions?

....of the container you are displaying the image in; if it is
body, it will be width of browser basically.... Normally, you
specify the width and height of the image in pixels. If you want
for it to scale, crappily if need be (most image enlargement is
crappy even in image software and should be avoided as far as
possible), don't specify both width and height, just width in %
and the browser will work out the height to save you specifying
in which case you need to get the % proportions correct.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top