I\'ve got a pretty simple problem, but I\'ve become clueless on what is causing the problem. In one of my applications I\'m using jCrop as a small add-on to crop images to fit i
Creating an 'Image' object and setting up the 'src' attribute does not apply that you can treat the image like it had already been loaded. Also, giving any fixed timeout interval does not guaranty the image has already been loaded.
Instead, you should set up an 'onload' callback for the Image Object - which will then initialize the Jcrop Object:
var src = 'https://example.com/imgs/someimgtocrop.jpg';
var tmpImg = new Image();
tmpImg.onload = function() {
//This is where you can safely create an image and a Jcrop Object
};
tmpImg.src = src; //Note that the 'src' attribute is only added to the Image Object after the 'onload' listener was defined