Unrealkin
07-16-2003, 04:53 AM
Is there any way to get the real size (width,height) of an image? Using following code when the second image has different dimensions than first one I can't get the real size but only some kind of "rescaled" values.
var tmp = new Image();
...
tmp.src = "image1.jpg"
x = tmp.width;
y = tmp.height;
...
document.images['pict'] = tmp.src
...
tmp.src = "image2.jpg"
x = tmp.width; // x<>real width of image2.jpg!
y = tmp.height; // y<>real height of image2.jpg!
...
document.images['pict'] = tmp.src
var tmp = new Image();
...
tmp.src = "image1.jpg"
x = tmp.width;
y = tmp.height;
...
document.images['pict'] = tmp.src
...
tmp.src = "image2.jpg"
x = tmp.width; // x<>real width of image2.jpg!
y = tmp.height; // y<>real height of image2.jpg!
...
document.images['pict'] = tmp.src