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:
Path path = Paths.get("image.png");
byte[] data = Files.readAllBytes(path);
byte[] encoded = Base64.getEncoder().encode(data);
String imgDataAsBase64 = new String(encoded);
String imgAsBase64 = "data:image/png;base64," + imgDataAsBase64;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With