PDA

View Full Version : Using Javascript to Resize an Image


Confused!
08-02-2005, 02:42 AM
Hey guys, I need help!

Basically I have a site that allows people to upload images, simple enough. The thing is, when displaying these images I want them to be as uniform as possible without going out of scale.

Basically what I'm looking for is a script that can output an image to scale within a certain constrained area. For example...if i have an image 500px by 300px and I have only an area of 200px width to display it in, I would like to be able to display the image with this new width of 200px but without it going out of proportion.

Can anyone help or know of a good script? I have seen many on resizing to browser windows or users resizing but all I want is a 'simple' way to just display them. I'm not asking to actually physically alter them but rather the appearnce on screen.

Hope you can help me I'd be soooo greatful!!! Thanks.

Confused!
08-02-2005, 03:41 AM
Anyone at all? Sorry for bumping this but I've searched everywhere and I'm not too good with JavaScript - pretty sure it's plausable though. Thanks again

glenngv
08-02-2005, 03:59 AM
<img src="image.gif" style="width:200px; height:auto;" alt="" />

Confused!
08-02-2005, 04:12 AM
<img src="image.gif" style="width:200px; height:auto;" alt="" />


My god thank you!!

I'm such a dumbass. I don't believe I didn't think of doing that, grrrr!! Haha.

Thanks again!!! You deserve that award. :thumbsup: