is there anyway to write image in freemarker instead of giving link as
<img src="${pathToPortalImage}
Note : cant we use otputstream or something in freemarker ?
is there anyway to write image in freemarker instead of giving link as
<img src="${pathToPortalImage}
Note : cant we use otputstream or something in freemarker ?
A great example above. But with JAVA 8 we can do something like this:
You can embed the image as base64 directly inside the html
img
tag.To convert an image to base 64 you can use Apache Commons (codec).
Here is a solution using Apache Commons IO + Codec (but you can do without if you want):
Then pass the variable
imgAsBase64
into the Freemarker context, and use it like this: