Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues of IndexSizeError in IE #348

Closed
wuyingyou opened this issue Jul 13, 2017 · 6 comments
Closed

Issues of IndexSizeError in IE #348

wuyingyou opened this issue Jul 13, 2017 · 6 comments

Comments

@wuyingyou
Copy link

Hi Guys,

Could you please help to address this issue only in IE10/IE11 ?

    var cropDemo = $('#demoImg').croppie({
        viewport: {
            width: 309,
            height: 309,
        },
        boundary: {
            width: 309,
            height: 309
        },
        enforceBoundary: false,
        customClass: 'square-image'
    });

Heads up for these 2 tips:

  1. Viewport is the same to the boundary
  2. enforceBoundary is false

Then when we zoom out, say, 0.5 and move the picture to clip partially, the 'IndexSizeError' occurs. After we do some research, we found the root cause is in the API call " ctx.drawImage(this.elements.preview, left, top, width, height, startX, startY, outWidth, outHeight);", if the 'width'/'height' is greater than 'this.elements.preview's width or height, then we got the bug.

We want to add some code to fix this issue, but some times still does not work.

.........
var ua = window.navigator.userAgent;
var old_ie = ua.indexOf('MSIE ');
var new_ie = ua.indexOf('Trident/');
if ((old_ie > -1) || (new_ie > -1)) {
if (width > self._originalImageWidth) {
width = self._originalImageWidth - left;
outWidth = width;
}
if (height > self._originalImageHeight) {
height = self._originalImageHeight - top;
outHeight = height;
}
}
ctx.drawImage(this.elements.preview, left, top, width, height, startX, startY, outWidth, outHeight);
.......

Attached some screenshots and my IE is IE11.

@manast @fdanielsen @bigamil @spookee86 @kmagiera , could some guys help to look at it? Appreciate your help.

@wuyingyou
Copy link
Author

old

@wuyingyou
Copy link
Author

clipped

@wuyingyou
Copy link
Author

fixing

@wuyingyou
Copy link
Author

Here is how we get base64 data.

$('#demoImg').croppie('result', {
type: 'base64'
}).then((resp) => {

                }).catch((err) => {
                       console.log('IndexSizeError ');
                });

@wuyingyou
Copy link
Author

here is the example in jsfiddle.

https://jsfiddle.net/barretwu/L5cr6fba/3/

Please use IE11 open it. Thanks again for your help.

error

@thedustinsmith
Copy link
Contributor

This will be fixed in the next release, thanks for pointing it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants