, mimes = { png:  'image/png' , gif:  'image/gif' , jpeg: 'image/jpeg' , jpg:  'image/jpeg' , ttf:  'font/ttf' , svg:  'image/svg+xml' } , types = [] ; for (var i in mimes) { types.push(i); }
function getBase64 (url, fn, opt) {
  var m = /^(https?):\/\/([^:\/]+)(?::(\d+))?([^:]*)$/.exec(url);
  if (!opt) opt = {};
  if (m !== null) {
    http.get({host:m[2], port:parseInt(m[3]||80), path:m[4]}, function (res) {
      var buf = ''
      res.setEncoding('binary');
      res.on('data', function (data) { buf += data; });
      res.on('end', function () {
        // TODO: Get MIME type from headers
        fn(new Buffer(buf, 'binary').toString('base64'), imageinfo(buf));
      });
    });
  } else {
    if (url[0] === '/') {
      url = (opt.base ? opt.base+'/' : '')+url.slice(1);
    } else {
      url = (opt.rel ? opt.rel+'/' : '')+url;
    }
    // TODO: Fallback to file extension for MIME type
    fs.readFile(url, function (err, data) {
      fn(data.toString('base64'), imageinfo(data));
    });
  }
}