How to get Height and Width of an image using java script :client side validation

      Validate Image height and width before uploading

----------------------------------------------------------------------------------
/*
   <script language="javascript">

        function getWidth()

        {

            var testImage = document.getElementById('testImage');

            alert(testImage.clientWidth);

        }

        function getHeight()

        {

            var testImage = document.getElementById('testImage');

            alert(testImage.clientHeight);

        }

        </script>
*/

// HTML code

<!---

<BODY>

        <input type="file" id="testImage" value="browse"/>

        <input type="button" value="get Width" onclick="getWidth()"/>

        <input type="button" value="get Height" onclick="getHeight()"/>

    </BODY>

--->
------------------------------------------------------------------------------------------

Popular posts from this blog

Android: where to run keytool command in android

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine