Commit 18c1e320 authored by Ningxin Hu's avatar Ningxin Hu

Fix image uploading failure for OpenCV.js tutorials

parent 315dac48
...@@ -12,7 +12,7 @@ function Utils(errorOutputId) { // eslint-disable-line no-unused-vars ...@@ -12,7 +12,7 @@ function Utils(errorOutputId) { // eslint-disable-line no-unused-vars
onloadCallback(); onloadCallback();
}); });
script.addEventListener('error', () => { script.addEventListener('error', () => {
this.printError('Failed to load ' + OPENCV_URL); self.printError('Failed to load ' + OPENCV_URL);
}); });
script.src = OPENCV_URL; script.src = OPENCV_URL;
let node = document.getElementsByTagName('script')[0]; let node = document.getElementsByTagName('script')[0];
...@@ -99,7 +99,7 @@ function Utils(errorOutputId) { // eslint-disable-line no-unused-vars ...@@ -99,7 +99,7 @@ function Utils(errorOutputId) { // eslint-disable-line no-unused-vars
let inputElement = document.getElementById(fileInputId); let inputElement = document.getElementById(fileInputId);
inputElement.addEventListener('change', (e) => { inputElement.addEventListener('change', (e) => {
let imgUrl = URL.createObjectURL(e.target.files[0]); let imgUrl = URL.createObjectURL(e.target.files[0]);
loadImageToCanvas(imgUrl, canvasId); self.loadImageToCanvas(imgUrl, canvasId);
}, false); }, false);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment