Open New window and size it to size of graphic

Discussion in 'ASP .Net' started by tshad, Feb 8, 2007.

  1. tshad

    tshad Guest

    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, Feb 8, 2007
    #1
    1. Advertising

  2. tshad

    Aidy Guest

    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" <> wrote in message
    news:%...
    >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, Feb 8, 2007
    #2
    1. Advertising

  3. tshad

    tshad Guest

    "Aidy" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:%...
    >>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, Feb 8, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cheryl
    Replies:
    2
    Views:
    18,049
    Cheryl
    Nov 12, 2003
  2. 50 SOMETHING GAL
    Replies:
    3
    Views:
    398
  3. Gordon
    Replies:
    3
    Views:
    299
    Steven Burn
    Apr 16, 2004
  4. PC HUA
    Replies:
    2
    Views:
    406
    PC HUA
    May 19, 2004
  5. Replies:
    1
    Views:
    232
Loading...

Share This Page