Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Open New window and size it to size of graphic (http://www.velocityreviews.com/forums/t386379-open-new-window-and-size-it-to-size-of-graphic.html)

tshad 02-08-2007 12:45 AM

Open New window and size it to size of graphic
 
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



Aidy 02-08-2007 10:08 AM

Re: Open New window and size it to size of graphic
 
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() + "');"); }

"tshad" <t@home.com> wrote in message
news:%23EHZnpxSHHA.1200@TK2MSFTNGP02.phx.gbl...
>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
>




tshad 02-08-2007 06:00 PM

Re: Open New window and size it to size of graphic
 
"Aidy" <aidy@noemail.xxxa.com> wrote in message
news:mLudnRlpdJQHa1fYnZ2dnUVZ8qCqnZ2d@bt.com...
> 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

>
> "tshad" <t@home.com> wrote in message
> news:%23EHZnpxSHHA.1200@TK2MSFTNGP02.phx.gbl...
>>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
>>

>
>





All times are GMT. The time now is 05:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.