Skip to content

Instantly share code, notes, and snippets.

@jimbuck
Last active December 23, 2015 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimbuck/29732633ec9a4068e8ce to your computer and use it in GitHub Desktop.
Save jimbuck/29732633ec9a4068e8ce to your computer and use it in GitHub Desktop.
Converts the current image to the base64 equivalent.
javascript: !function(){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var e=new FileReader;e.onloadend=function(){window.open(e.result,"_blank")},e.readAsDataURL(n.response)},n.open("GET",window.location.href),n.send()}();
function make64(){
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function() {
var reader = new FileReader();
reader.onloadend = function () {
window.open(reader.result, "_blank");
}
reader.readAsDataURL(xhr.response);
};
xhr.open('GET', window.location.href);
xhr.send();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment