Click to See Complete Forum and Search --> : Popup sized by Image size
gportella
02-26-2003, 08:45 AM
The correct is:
How I can set the size of a popup window with the size (width and height) of an image?
Thanks again.
dabush
02-26-2003, 08:49 AM
lets say the width of the img is called imgwidth and height of the img is called imgheight.
open("url.html","windowname","width=imgwidth,height=imgheight");
gportella
02-26-2003, 09:50 AM
Originally posted by dabush
lets say the width of the img is called imgwidth and height of the img is called imgheight.
open("url.html","windowname","width=imgwidth,height=imgheight");
Ok, but the really thing goes like:
1 - I will create an instance of an image object;
2 - Then I will load the image into the src property of the object;
3 - HOW I GET THE IMAGE SIZE USING THE IMAGE OBJECT CREATED ?
This is the question, sorry if i wasn't clear.
thanks.
khalidali63
02-26-2003, 09:53 AM
var img = new Image();
img.src = "someImage.gif"
X = img.width
Y = img.height;
Hope this helps
Cheers
Khalid
gportella
02-26-2003, 10:11 AM
Originally posted by khalidali63
var img = new Image();
img.src = "someImage.gif"
X = img.width
Y = img.height;
Hope this helps
Cheers
Khalid
===========================================
Ok, this works and now i will give you a problem that came,
my script goes below:
function Ampliar(arquivo) {
titulo = "Posto Planalto";
var img_src = new Image;
img_src.src = arquivo;
img_w = img_src.width;
img_h = img_src.height;
var wdoc = window.open("", "Fotos", "toolbar=0,menubar=0,statusbar=0,location=0,height=" + img_h + ",width=" + img_w);
wdoc.document.open();
wdoc.document.write("<html><head><title>" + titulo + "</title></head>");
wdoc.document.write("<body leftmargin='0' topmargin='0'>");
wdoc.document.write("<img src='" + img_src.src + "' width='" + img_w + "' height='" + img_h + "'></img>");
wdoc.document.write("</body></html>");
wdoc.document.close();
}
the problems is that when the script is running and i click in an image the popup window open in the top of the screen and with a size that is not the image size and to complete the bug the image doesn't apear.