title: How to get base64 encoded data from html image
body: <p>I have a registration form where users can choose an avatar. They have 2 possibilities:</p>
  
  <ol>
  <li>Choose a default avatar</li>
  <li>Upload their own avatar</li>
  </ol>
  
  <p>In my HTML page I have this.</p>
  
  <pre><code>&lt;img id="preview" src="img/default_1.png"&gt;
  </code></pre>
  
  <p>It displays the chosen avatar.
  I use the File Api to let users upload their own image.
  That makes the src of the HTML image to something like this.</p>
  
  <pre><code>&lt;img id="preview" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA... /&gt;
  </code></pre>
  
  <p>When they post the registration form. The data will be sent to a REST service.
  I can send the base64 encoded data when a user uploaded an avatar himself. But how do I handle the default avatar? It is an url instead of base64 encoded data.</p>