title: Freemarker embed image on ftl
body: <p>I am trying to embed an image on a Freemarker ftl template to send as an email, I've based on this question <a href="https://stackoverflow.com/questions/13339445/feemarker-writing-images-to-html">Feemarker writing images to html</a>, I did the exact same thing as this question said, but the email is being generated like <a href="http://prntscr.com/g0bkty" rel="nofollow noreferrer">this</a></p>
  
  <p>What may be causing this error, and how to fix it?</p>
  
  <p>My template looks like this </p>
  
  <pre><code>&lt;img alt="My image" src="${imgAsBase64}" /&gt;
  </code></pre>
  
  <p>The image is a Chart, and I get the Base64 String, which I called imageBase64Str, via a Primefaces JavaScript function that generates the Base64 of the chart image, I pass it to the the bean and pass the parameter to the template like this </p>
  
  <pre><code>String encoded = imageBase64Str.split(",")[1];
  byte[] decoded = Base64.decodeBase64(encoded);
  String imgDataAsBase64 = new String(decoded);
  String imgAsBase64 = "data:image/png;base64," + imgDataAsBase64;
  emailParams.put("imgAsBase64", imgAsBase64);
  </code></pre>