Skip to content

Instantly share code, notes, and snippets.

@gabskoro
Created February 2, 2016 07:53
Show Gist options
  • Save gabskoro/0a8875504abfa82a7e7a to your computer and use it in GitHub Desktop.
Save gabskoro/0a8875504abfa82a7e7a to your computer and use it in GitHub Desktop.
Show an image
$(function() {
var $logoInput = $('#logo-input');
var $logoImage = $('.logo-image');
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$logoImage.attr('src', e.target.result);
};
reader.readAsDataURL(input.files[0]);
}
}
$logoInput.change(function() {
readURL(this);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment