I have the following code:
var checkImgDim=new Image();
checkImgDim.src=e.target.result;
if (input.files[0].size > MAX_SIZE)
setError("File too large - max 3MB");
else if (checkImgDim.naturalHeight < MIN_H ||
checkImgDim.naturalWidth < MIN_W)
setError("Image dimensions too small");
It works fine under Chrome however with Firefox I'm getting inconsistent results because it seems that naturalHeight and naturalWidth return 0 sometimes and there's a delay before the values are set. I don't want to load the image into the DOM or use .onload() the whole purpose of the code is simply to check the image dimensions. I don't think it would be good practice to add a time delay here. Can someone please tell me what the proper way to check the image dimensions?