DOMException 'drawImage' on 'CanvasRenderingContext2D' in Chrome & Safari
See original GitHub issueExpected Behavior
When using croppie.js in combination with ng-croppie.js together should be working in Chrome or Safari.
Actual Behavior
Croppie throws endless uncaught DOMException. Since new release of the Chrome 66 croppie.js throws constantly errors while working with ng-croppie library. In previous Chrome versions (tested on 65, 64 etc.) everything worked fine, but with the new Chrome release it hanging out on:
LOC 1179 for v2.6.2
ctx.drawImage(this.elements.preview, left, top, width, height, startX, startY, canvasWidth, canvasHeight);
LOC 1188 for v2.5.1
ctx.drawImage(this.elements.preview, left, top, Math.min(width, self._originalImageWidth), Math.min(height, self._originalImageHeight), startX, startY, outWidth, outHeight);
Error Description
Uncaught (in promise) DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
The same code running in other browsers (tested on Firefox v59.0.2 and Internet Explorer v11.0.56) does not throw above mentioned error.
Steps to Reproduce the Problem
- include croppie.js
- include ng-croppie (v1.2.2)
- instantiate angular 1.x app
Example Link
Specifications
- Browser: Chrome 66.0.3359.139 or Safari 11.1.2
- Version: either 2.5.1 or 2.6.2
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:11 (1 by maintainers)
I have the same error usnig fabric.js, Chrome 67. Firefox does not present this problem.
@thedustinsmith, console logs also show 0 for elements height and width at L1133 and L1172. Btw, I also have checked it with latest Chrome version (66.0.3359.181) and can confirm @lacek’s comment regarding error occurence in newest Chrome.
Update: 13.11.2018 The same applies to Chrome 70.0.3538.102 Update: 25.09.2018 The same applies to Chrome 69.0.3497.100 and Safari 12.0 (13606.2.11) Update: 02.08.2018 The same applies to Chrome 68.0.3440.84 and Safari 11.1.2 Update: 13.07.2018 The same applies to Chrome 67.0.3396.99 Update: 19.06.2018 The same applies to Chrome 67.0.3396.87 Update: 04.06.2018 The same applies to Chrome 67.0.3396.62