Open New window and size it to size of graphic

T

tshad

I have an aspx window that is going to open a window (javascript) and
display a graphic. I want to resize the window to the size of the graphic
before it actually displays - how do I do that?

In my calling routine I have the following:
***********************************
function OpenLogoPreviewWindow()
{
window.open('logoDisplay.htm','mywindow');
}
***********************************

The logoDislay.htm page is:
****************************
<script language="JavaScript">

function entry()
{
document.LogoDisplay.src = "..\\..\\uploads\\" +
opener.document.getElementById('Logo').innerHTML;
window.resizeTo(?,?);
}
</script>
</head>
<body onLoad="entry()">
<img name="LogoDisplay">
</body>
</html>
*************************************

The program works fine but the window the graphic displays in is way to big
and the each graphic is a different size so I need the window to only be the
size of the graphic.

Thanks,

Tom
 
A

Aidy

Assume the script is in the same folder as your image

string filename = "mypic.jpg";
Image img = new Bitmap(Server.MapPath(filename));
Size size = img.Size;
img.Dispose();

string scriptToWrite = "window.open ('" + filename + "', '_blank',
'menubar=no, status=no, toolbar=no, width=" + size.Width.ToString() + ",
height=" + size.Height.ToString() + "');"); }
 
T

tshad

Aidy said:
Assume the script is in the same folder as your image

string filename = "mypic.jpg";
Image img = new Bitmap(Server.MapPath(filename));
Size size = img.Size;
img.Dispose();

string scriptToWrite = "window.open ('" + filename + "', '_blank',
'menubar=no, status=no, toolbar=no, width=" + size.Width.ToString() + ",
height=" + size.Height.ToString() + "');"); }

I got this working but the status bar shows anyway. Is there a way to get
the status bar to disappear?

Thanks,

Tom
 

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

Top