I'm using a function to Validate the size of an uploaded image. That works fine, now I also want to check if the image is wider than certain pixels (like 1280 pixels). But the var width still gives zero. I already tried to use outerwith, innerwidth and file.files[0].width;
function ValidateSize(file) {
var FileSize = file.files[0].size / 1024 / 1024; // in MB
var NewFilze = FileSize.toFixed(2);
var height = file.height;
var width = file.width;
if (FileSize > 13) {
alert("The file size of your picture (" + NewFilze + " MB) exceeds the maximum allowed filesize (12,5 MB). Still problems with resizing your pictures? Use for example www.imageresize.org.");
}else if(width < 1280){
alert("The width of your image (" + width + " pixels) is lower than the required minimum width (1280 pixels)");
}else{
}
}
Thanks in advance