Can javascript give me image dimensions?

Discussion in 'Javascript' started by Randell D., Sep 25, 2003.

  1. Randell D.

    Randell D. Guest

    Folks,
    I want to create a popup for thumbnail images (jpg, png, gif) and wonder if
    I can create a popup that opens a new window whereby the image fits the new
    window 100%... I know I can have my Apache/PHP server do this, but my
    preference leans towards clientside javascript...

    Thus... can javascript calcuate the width/height of an image for me to do
    the above?

    thanx

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is top-posting such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet?
    Randell D., Sep 25, 2003
    #1
    1. Advertising

  2. Randell D.

    Randell D. Guest

    "Randell D." <> wrote in message
    news:uYvcb.17624$TM4.16131@pd7tw2no...
    >
    > Folks,
    > I want to create a popup for thumbnail images (jpg, png, gif) and wonder

    if
    > I can create a popup that opens a new window whereby the image fits the

    new
    > window 100%... I know I can have my Apache/PHP server do this, but my
    > preference leans towards clientside javascript...
    >
    > Thus... can javascript calcuate the width/height of an image for me to do
    > the above?
    >
    > thanx
    >


    Got it... from an old post...

    <script Language='javascript1.2' type='text/javascript'>
    <!--
    function iLoad(isrc) {
    var oImg = new Image();
    oImg.src = isrc;
    if (oImg.complete) {
    window.alert(oImg.src + ' ' + oImg.width + ' x ' + oImg.height);
    }
    else {
    window.setTimeout('iLoad(imgsrc)', 1000);
    }
    }
    //-->
    </script>
    </HEAD>
    <body onLoad='iLoad(imgsrc)'>
    </body>
    </HTML>
    Randell D., Sep 26, 2003
    #2
    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. Assaf
    Replies:
    0
    Views:
    366
    Assaf
    May 10, 2004
  2. Scott Reynolds

    Calculate image dimensions

    Scott Reynolds, Aug 29, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    476
    Scott Reynolds
    Aug 29, 2004
  3. James T.

    Image Dimensions?

    James T., Jan 16, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    486
    Spam Catcher
    Jan 16, 2006
  4. Jbj4712
    Replies:
    11
    Views:
    7,129
    Eric B. Bednarz
    Nov 3, 2004
  5. grocery_stocker
    Replies:
    10
    Views:
    612
    Keith Thompson
    May 25, 2005
Loading...

Share This Page