Popup - detect and autosize to image

Discussion in 'ASP General' started by Jake, May 25, 2005.

  1. Jake

    Jake Guest

    Hi,
    I have a page with a bunch of thumbnails that when clicked, open the full
    size image in a new window. They are all different sizes and its a bit
    unprofessional looking. I'd like to find a component or script that will
    detect the size of the linked image and create a popup correctly sized to
    the image. Would have no toolbar, buttons,scrolling, etc. Just a clean,
    correctly sized window.

    Any way to do this?

    TIA
     
    Jake, May 25, 2005
    #1
    1. Advertising

  2. Jake

    McKirahan Guest

    "Jake" <> wrote in message
    news:...
    > Hi,
    > I have a page with a bunch of thumbnails that when clicked, open the full
    > size image in a new window. They are all different sizes and its a bit
    > unprofessional looking. I'd like to find a component or script that will
    > detect the size of the linked image and create a popup correctly sized to
    > the image. Would have no toolbar, buttons,scrolling, etc. Just a clean,
    > correctly sized window.
    >
    > Any way to do this?
    >
    > TIA



    Will this help? Watch for word-wrap.

    <html>
    <head>
    <title>enlarge.htm</title>
    <script type="text/javascript">
    function enlarge(image) {
    var i = new Image();
    i.src = image;
    var x = i.width;
    var y = i.height;
    // window.status for degugging:
    window.status = image + " = " + x + " x " + y + " pixels";
    var z = "scrollbars=no,width=" + (x+20) + ",height=" + (y+20);
    window.open(image,"image",z);
    }
    </script>
    </head>
    <body>
    <a
    href="javascript:enlarge('http://www.google.com/intl/en/images/logo.gif');"
    ><img src="http://groups-beta.google.com/images/google_sm.gif"

    border="1" width="143" height="59" alt="Click to enlarge"></a>
    </body>
    </html>
     
    McKirahan, May 26, 2005
    #2
    1. Advertising

  3. Jake

    Mark Schupp Guest

    first you will need to get the actual size of the image. best time to do
    this is when you upload the image (keep info in a database so that you don't
    have to extract it every time a page is displayed). If you know the size at
    that time use it. otherwise see http://www.aspfaq.com/show.asp?id=2170 for
    info about extracting size.

    Embed the size in your window.open statement (in the client-side code you
    generate) for each thumbnail link.

    --
    Mark Schupp



    "Jake" <> wrote in message
    news:...
    > Hi,
    > I have a page with a bunch of thumbnails that when clicked, open the full
    > size image in a new window. They are all different sizes and its a bit
    > unprofessional looking. I'd like to find a component or script that will
    > detect the size of the linked image and create a popup correctly sized to
    > the image. Would have no toolbar, buttons,scrolling, etc. Just a clean,
    > correctly sized window.
    >
    > Any way to do this?
    >
    > TIA
    >
    >
     
    Mark Schupp, May 26, 2005
    #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. Ryou kaihou
    Replies:
    1
    Views:
    423
    Eric Moreau
    Jun 14, 2007
  2. Wayne  Wengert

    Autosize Image Control

    Wayne Wengert, Mar 8, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    233
    Wayne Wengert
    Mar 9, 2005
  3. Ryou kaihou
    Replies:
    1
    Views:
    193
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Jun 14, 2007
  4. Ryou kaihou
    Replies:
    0
    Views:
    148
    Ryou kaihou
    Jun 14, 2007
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    596
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page