Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created July 31, 2013 18:20
Show Gist options
  • Save enjalot/6124647 to your computer and use it in GitHub Desktop.
Save enjalot/6124647 to your computer and use it in GitHub Desktop.
smiley base64
{"description":"smiley base64","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"smiley.svg":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/t873P5O.png"}
var svg = d3.select("svg")
var svgString = new XMLSerializer().serializeToString(d3.select(".tributary_svg").node());
console.log(svgString)
var base64 = btoa(svgString);
var imgStr = "data:image/svg;base64," + base64
console.log(base64)
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment