SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot sajjad's Avatar
    Join Date
    May 2005
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to get the image width and height

    hi 2 everyone.

    i have a problem plz help me.
    i have a form and in that form i have a file field through that i can browse for images.

    now what i want is that whatever the image file user selected i need the width and height of that image .

    i need some script which should work on IE and Mozilla

    thanx alot
    If you lose your patience you lose half of battle

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can only do that once the file is uploaded to the server.

  3. #3
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you can put the img in a span (position:relative; padding:0)
    you can get the span's offsetHeight and offsetWidth properties in most of the browsers, which will reflect the img dimensions.

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See this thread


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
  •