Here is my code:
if($('#profileimg').val())
{
var fsize = $('#profileimg')[0].files[0].size; //get file size
var ftype = $('#profileimg')[0].files[0].type; // get file type
if(fsize>5242880)
{
$("#filetype").html("<b> Profile Image "+bytesToSize(fsize) +"</b> <br />File is too big, it should be less than 5 MB.");
return false
}
if(filetypeimage(ftype))
{
var file, img;
if ((file = $('#profileimg')[0])) {
img = new Image();
img.onload = function() {
alert(this.width + " " + this.height);
};
img.onerror = function() {
alert( "not a valid file: " + file.type);
};
img.src = _URL.createObjectURL(file);
}
I want to get the image width and height and also i want to get the resolution of video which is going to be uploaded on our server.
Thanks in advance