I saw this code to get the size(KB, MB)
of an image. But this code is getting the data from the button after change. Can this code apply to my question?. Or is there any other way to directly get the size of the image using javascript?.
$(function () {
$("#btnClick").change(function (e){
var a = e.target.files[0];
alert(parseFloat(a.size / 1024).toFixed(2) + " KB.");
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="file" id ="btnClick"/>
EDIT
As nnnnn
said. I have an IMG (eg. < img src="someimg.jpg">)
I want to get the size of this picture. How do I get it?. As my example above it store the size in the button and retrieve it.