Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. problem in getting image width and height

problem in getting image width and height

Scheduled Pinned Locked Moved Web Development
helptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tamimi Code
    wrote on last edited by
    #1

    hi all i am trying to get the with and th hieght of an image, this my code

    function readImg()
    {
     var imgTest
     imgTest= new Image(); 
     imgTest.src = strImgPath
     intWidth = imgTest.width;
     intHeight = imgTest.height;
    }
    

    in the first calling of this function i am getting zeros. but in a second call i got the real values. how to salve this issue ??

    When you get mad...THINK twice that the only advice Tamimi - Code

    T 1 Reply Last reply
    0
    • T Tamimi Code

      hi all i am trying to get the with and th hieght of an image, this my code

      function readImg()
      {
       var imgTest
       imgTest= new Image(); 
       imgTest.src = strImgPath
       intWidth = imgTest.width;
       intHeight = imgTest.height;
      }
      

      in the first calling of this function i am getting zeros. but in a second call i got the real values. how to salve this issue ??

      When you get mad...THINK twice that the only advice Tamimi - Code

      T Offline
      T Offline
      Tamimi Code
      wrote on last edited by
      #2

      function readImg() { var imgTest imgTest= new Image(); imgTest.src = strImgPath imgTest.onload=function(){ intGeneralWidth = imgTest.width; intGeneralHeight = imgTest.height;} }

      When you get mad...THINK twice that the only advice Tamimi - Code

      P 1 Reply Last reply
      0
      • T Tamimi Code

        function readImg() { var imgTest imgTest= new Image(); imgTest.src = strImgPath imgTest.onload=function(){ intGeneralWidth = imgTest.width; intGeneralHeight = imgTest.height;} }

        When you get mad...THINK twice that the only advice Tamimi - Code

        P Offline
        P Offline
        Paul Conrad
        wrote on last edited by
        #3

        Good deal finding the solution :)

        "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups