SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Russia
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to know width and height of an image?

    Suppose I have an image - "image.gif"
    How to know its width and height ?

    Thank you
    Regards,
    Alexander Saprykin
    http://www16.brinkster.com/saprykin

  2. #2
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, if you have a name for your image in the IMG tag (i.e "<IMG Name="image1">", etc.) then I think you can do something like this (forgive me, my JavaScript knowledge may be somewhat outdated:

    var1 = document.image1.height;
    var2 = document.image1.width;
    var3 = document.image1.src;

    and so on.

    Let me know if this works. I hope it helped.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Open the image in your browser and right click --> view properties. It'll say "Dimensions: 179 x 59 pixils. The first number is always width, second is height.
    signature

  4. #4
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh, sorry, i thought you meant coding it into your web pages from a file or something.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  5. #5
    SitePoint Enthusiast lieblick's Avatar
    Join Date
    Jun 2001
    Location
    Tallahassee, FL
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since we're all tossin' up various ways ...

    There's a php function that will also return the dimensions of an image ...
    Vendor Ratings, Coupons & Specials:
    http://www.outcrier.com
    My Personal Site:
    http://www.epock.com

  6. #6
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ....and therefore one in ASP that's easier as well.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  7. #7
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol at Goober

  8. #8
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, when I authored my first stupid reply, it was very early morning.

    I won't take back the comment about ASP, however. Sticking by my guns on that one.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •