1 year ago


Posted 1 year ago by HossamAli

I have this code but the bool inside the onload is not set except after everything finishes

(function () {
                    var width, height;
                    var _img = new Image();
                    _img.src = window.URL.createObjectURL(image);
                    _img.onload = function () {
                        width = _img.naturalWidth;
                        height = _img.naturalHeight;
                        if (width * height < 10000000) {
                            notValid = true;

is there another to get the image real width and height without the onload function or how to set the bool inside it immediately

Please sign in or create an account to participate in this conversation.