Posted By

LuckyShot on 10/11/09


Tagged

javascript image png userscripts


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

wirenaught


Embed image as code (for UserScripts)


 / Published in: JavaScript
 

Saves an image as code. Useful for small images.

  1. // Declare it
  2. var MP3_IMG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABl0lEQVR4nJ3P3UuTARTH8fMv9R94Uwp2kaBpWIjDUiRiuBRCDLcnX2JQos6y6cTW3HyZbo0tQbbmhs6XBT3OTWurYKgrvXDeeLELv114YyGPmxfn5vz4fQ5HBJFipqp7iubX88R2c/yTFQvce+mlyrzEM+9PllMXkGKBZtsGTc4MLa4ftNk3SgceO5Ion7JUvwpR9vRd6YDeGiS2m6PGZOeGTrnGC4N+BBGTzUfFE3PpQOuQD0FkcVXFG46XDtT3THNp9v9CzRzijx/giWWJqlm20nsIIg96Z64GllN5rKEjFN8RBuceylyCfleEhUiChr5ZbSCazmMKHLO5X2DzD0yoZ+hnMlQaXdzpHKdjaF4baPfksKfg1ykkT8CdAcP0DuWd76k1TmG0eLSBupGvKKE8k8kCk9sFepYOqTMHuP3cwcM3K1iCv7WBxpEw9weCtE58ocUW526fl8quDzwai9Hh3Lq8fBFwRNLUvnBxyzDKTcPb88vWNdpnv+Fez14NCCLule/ohj/TYImiG11j4GOCsKpRRuQvG2SsxuXIJ3AAAAAASUVORK5CYII=';
  3.  
  4. // Then call it whenever you need it
  5. aStyle.background = 'transparent url('+MP3_IMG+') no-repeat';

Report this snippet  

You need to login to post a comment.