Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function loadImage(file) {
img = new Image();
img.onload = e => drawImageToCanvas();
img.onerror = e => $log.warn('Failed to load image.');
fileReader = new FileReader();
fileReader.onload = e => img.src = e.target.result;
fileReader.onerror = e => $log.warn('Failed to load file.');
fileReader.readAsDataURL(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.