Created
November 27, 2018 22:19
-
-
Save RedRussianBear/9be3a48fe91260be987dbd783e85192e to your computer and use it in GitHub Desktop.
This file contains 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
// Image upload handler | |
$('#upload').change(function () { | |
const file = this.files[0]; | |
const reader = new FileReader(); | |
reader.readAsDataURL(file); | |
reader.onload = function () { | |
$('body').css('background-image', 'url("' + reader.result + '")'); | |
$('#colors').html('<h2>Processing...</h2>'); | |
getColors(reader.result.substr(reader.result.search('base64,') + 7)); | |
}; | |
reader.onerror = function (error) { | |
console.error('Error: ', error); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment