Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could use a <a href="http://en.wikipedia.org/wiki/Data_URI_scheme" rel="nofollow">data uri</a> to include the images in your source. I don't know enough about Node.JS to tell you how to programmatically do it, but since you were just going to store them in variables anyway it should be easy to convert the images to data uris and store those in vars. Most modern browsers (and IE8+) support data uris. If you search for "data uri generator" you should find plenty of them online.</p> <p>I personally like the <a href="https://addons.mozilla.org/en-US/firefox/addon/base64-encoder/" rel="nofollow">Base64 Encoder</a> extension for Firefox. It is a quick and convenient way to make data uri images when I need them.</p> <p><strong>Update</strong></p> <p>After a little more research, you could maybe store a base64 encoded string and then load it into a <a href="http://nodejs.org/docs/v0.4.8/api/buffers.html" rel="nofollow">Buffer</a> and do something like this:</p> <pre><code>var image1 = new Buffer('iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAIAAACHqfpvAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABlSURBVChTjVDJDQAgCGMuB2Iep3EZh0GEqiQekQ8htLSFmGKlXOW/yKCFicsvqeYE8IGsS5gBRk97dV9x2MjrruIsBdo09lCel03LteEFRt7kS3wlmZPRRQ6Zg3YHrxeMpzpAdw2MaCJX2CUsrAAAAABJRU5ErkJggg==', 'base64'); response.writeHead(200, { 'Content-Length': image1.length, 'Content-Type': 'image/png' }); response.end(image1); </code></pre> <p>It looks like you could even do it with the copy-pasted raw data using the "binary" encoding with a Buffer, but that has been deprecated so I'd stick with something more reliable like base64.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload