Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   General Discussions (http://forums.winamp.com/forumdisplay.php?f=1)
-   -   Is there a way to changean image's display dimentions in javascript? (http://forums.winamp.com/showthread.php?t=204765)

dlinkwit27 12th January 2005 23:33

Is there a way to changean image's display dimentions in javascript?
 
I'm trying to mod the Weather widget that comes with Konfabulator, and the current method that is used is there are two sizes of each image. For the small images, the small version is called. What I want to do is elimiate this method, and call the large image, and resize it.

Is there a javascript method to do this?

I tried .width=10; and .height=10; and it yelled @ me.

/edit
an example of the code I'm working with
code:
case "40": // Showers
forecastImage[whichTiny][0].opacity = 0;
forecastImage[whichTiny][1].src = "Resources/Rain Cloud.png";
forecastImage[whichTiny][1].hOffset = horzOffset + 4;
forecastImage[whichTiny][1].vOffset = vertOffset + 7;
forecastImage[whichTiny][2].src = "Resources/Light Rain.png";
forecastImage[whichTiny][2].opacity = 255;
forecastImage[whichTiny][2].hOffset = horzOffset + 4;
forecastImage[whichTiny][2].vOffset = vertOffset + 18;
//where I want to chnge height
//where I want to change width
break



I googled but all I can fine is how to get the dimentions. Nothing in setting them.

ryan 13th January 2005 00:01

You can't resize the image with javascript. You can display it at a smaller size, but you still have to load the full image.

.width and .height should work fine.

img.style.width='20px';
img.style.height='20px';

dlinkwit27 13th January 2005 00:31

I don't mind loading the whole image, as it is just for a small application on my desktop, not for a site. I'll try .style.width=XX; and see what happens.

zootm 13th January 2005 12:06

The .style properties change the CSS attributes of the object. I'm not sure if that scales images, but I think it does.

Joel 13th January 2005 13:47

What's wrong with width and height attributes from <img>....?

After all, the end-user will see the re-sized image.

zootm 13th January 2005 14:10

Actually, you could probably use the setAttribute() DOM method to set the "width" and "height" things, yeah.

dlinkwit27 13th January 2005 15:28

I'm still gettign yelled at, so idk....I give up.

dlinkwit27 13th January 2005 15:30

1 Attachment(s)
forgot to attach :p change the filetype from .txt to .js after download, if anyone takes the time.


All times are GMT. The time now is 10:09.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.