title: jspdf to addImage : error supplied data is not a JPEG
body: <p>I am trying to add an image to my pdf:</p>
  
  <pre><code>var image = '../images/example.jpg';
  doc.addImage(image, 'JPEG', 0, 0, 700, 145);
  </code></pre>
  
  <p>and I get this error:</p>
  
  <blockquote>
    <p>Error: Supplied data is not a JPEG</p>
  </blockquote>
  
  <p>however, when I add a base64 image:</p>
  
  <pre><code>var image = 'data:image/jpeg;base64,/9j/6GADS...'
  doc.addImage(image, 'JPEG', 0, 0, 700, 145);
  </code></pre>
  
  <p>it works fine!</p>
  
  <p>why is the first version not working?
  I am trying this:</p>
  
  <pre><code>var image = $base64.encode('../images/example.jpg')
  </code></pre>
  
  <p>the same error above again!</p>
  
  <p>what is happening here? what is the solution?</p>