Skip to content

Instantly share code, notes, and snippets.

@vrushank-snippets
Created June 26, 2013 11:25
Show Gist options
  • Save vrushank-snippets/5866695 to your computer and use it in GitHub Desktop.
Save vrushank-snippets/5866695 to your computer and use it in GitHub Desktop.
jQuery: preview image
// Preview Image
function preview(input)
{
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e) {
$('#preview_image')
.attr('src', e.target.result)
.width(160)
.height(160);
};
reader.readAsDataURL(input.files[0]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment