Created
January 15, 2010 14:51
-
-
Save nmerouze/278104 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Page Title</title> | |
<meta charset="utf-8" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script> | |
$(function() { | |
var canvas = document.createElement("canvas"); | |
var img = new Image(); | |
img.onload = function() { | |
canvas.width = img.width; | |
canvas.height = img.height; | |
canvas.getContext('2d').drawImage(img, 0, 0); | |
var imgBase64 = canvas.toDataURL(); | |
$("body").append($("<img/>").attr("src", imgBase64)); | |
} | |
img.src = "http://a1.twimg.com/profile_images/227161380/redme.jpg"; | |
}); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment