Not doing image sizing correctly

T

tshad

I have 2 labels that hold the name of different images.

<asp:Label ID="Logo" runat="server"/>
<asp:Label ID="CompanyPicture" runat="server"/>&nbsp;&nbsp;&nbsp;&nbsp;

I have 2 links that open the windows to preview these images. The previewed
images are done on separate html pages that do nothing but display the
image.

function OpenLogoPreviewWindow()
{
window.open('logoDisplay.htm','myWindow','menubar=no,toolbar=no,directories=no,resizable=no,scrollbars=no,location=no,status=no');}function OpenPicturePreviewWindow(){ window.open('CompanyPictureDisplay.htm','myWindow','menubar=no,toolbar=no,directories=no,resizable=no,scrollbars=no,location=no,status=no');}This works most of the time. But the first time you do it, it has the wrongdimensions. For example, for the CompanyPicture - the size is 502 by 400.The very first time a machine loads this picture, it will be incorrect. Itwill be something like 38 by 87. From that point on it will be correct.Even if I change the picture - it will size it correctly. It will also workif I reboot the machine. To test it I need to go to another machine thathas never run it.The code for each page is:logoDisplay.htm**************************************************************************function entry(){//alert("In LogoDisplay"); document.LogoDisplay.src = "..\\..\\uploads\\" +opener.document.getElementById('Logo').innerHTML; id = document.getElementById("LogoDisplay"); w = id.width+10; h = id.height+50;// alert ("w = " + w + " h = " + h); window.resizeTo(w,h); if (screen) { x = (screen.availHeight - h)/2; y = (screen.availWidth - w)/2; } window.moveTo(y,x); window.focus();}</script></head><body onLoad="entry()"><img name="LogoDisplay"></body></html>************************************************************************For ComapnyPictureDisplay.htm***********************************************************************function entry(){ document.PictureDisplay.src = "..\\..\\uploads\\" +opener.document.getElementById('CompanyPicture').innerHTML; id = document.getElementById("PictureDisplay"); w = id.width+10; h = id.height+50;// alert ("w = " + w + " h = " + h); window.resizeTo(w,h); if (screen) { x = (screen.availHeight - h)/2; y = (screen.availWidth - w)/2; } window.moveTo(y,x); window.focus();}</script></head><body onLoad="entry()"><img name="PictureDisplay"></body></html>****************************************************************************
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top