From fbf58be7ec798c7b62db7b81d7d8230f1ac15a35 Mon Sep 17 00:00:00 2001 From: edjeed <5947916+edjeed@users.noreply.github.com> Date: Sun, 15 Oct 2017 21:42:11 +0200 Subject: [PATCH] Fixed bug on loadExistingImage loadExistingImage did not work, jquery reported error on 'load' function. --- croppic.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/croppic.js b/croppic.js index 6ab5d14..5a0c303 100644 --- a/croppic.js +++ b/croppic.js @@ -267,13 +267,14 @@ var img =$(''); that.obj.append(img); - img.load(function() { - that.imgInitW = that.imgW = this.width; - that.imgInitH = that.imgH = this.height; - that.initCropper(); - that.hideLoader(); - if (that.options.onAfterImgUpload) that.options.onAfterImgUpload.call(that); - }); + var image = new Image(); + image.src = that.options.loadPicture; + that.imgInitW = that.imgW = image.width; + that.imgInitH = that.imgH = image.height; + that.initCropper(); + that.hideLoader(); + if (that.options.onAfterImgUpload) that.options.onAfterImgUpload.call(that); + }else{ that.cropControlRemoveCroppedImage.on('click',function(){