Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
 <h1 id="heading">? </h1>
</body>
</html>
 
var is  = false;
function isPortrait(src) {
  
    var img = new Image();
    img.src = src;
   var  here = img.onload = function() {
        alert(img.width+"x"+img.height);
        if(img.height>img.width)
        {
            is = true;
         
          alert(is + "9");
        }
      // it is here at this moment where you can get result of the 
     // awaited async function onload() 
     document.getElementById("heading").innerHTML = "is it Portrait ? " + is;
    
    };
    
    
   
}
 isPortrait("http://blogs.smithsonianmag.com/aroundthemall/files/2009/01/npg_portraits_nicholson_jack_2002-244x300.jpg");
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers