473,413 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

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
Feb 8 '07 #1
2 2099
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.comwrote in message
news:%2****************@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

Feb 8 '07 #2
"Aidy" <ai**@noemail.xxxa.comwrote in message
news:mL******************************@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.comwrote in message
news:%2****************@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').innerHTM L;
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


Feb 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
7
by: Mark | last post by:
Hello; Here is what I wish to do: Click on a PDF link and have it open as a full screen window - not as a predetermined size. Sounds simple? I want to run the command from within the...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
3
by: Grey | last post by:
I know I need to use client side script to open new window, window.open("URL"). However, the URL in the function is dinamically generated by server side. How can I open window in client side, but...
4
by: gabe | last post by:
i have a solution to gather the text in each window that is open, but would rather use only managed code rather than unmanaged code my current solution relies on. The purpose is to get the text in...
1
by: Alejandro Vidal | last post by:
Hi, I have a curius problem, I hava a flash in a html page. In flash I have a button to open a pop up with this code: getURL...
2
by: kimiraikkonen | last post by:
Hi, I need to show an active window's (form) size(width and height in pixels) in message box, however there are some low-level api calls in user32.dll but i don't know which function returns the...
1
by: peerraghu | last post by:
hi i am creating travels project using .net and c# and iam new to java scripts i want to open new window with in the same page after clicking the image i have wreiten code just look at this ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.