Created
January 6, 2016 15:36
-
-
Save thebuilder/fdb31e1b440c0bef75dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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