Skip to content

Embedding svg images in html output #1624

Closed Answered by dariobella
dariobella asked this question in Q&A
Discussion options

You must be logged in to vote

Nevermind, I was very close to the right solution, I just overlooked that I needed to put the MIME type of the image in the result and not just the extension. With this as the content of the handleImage function it's now all working properly :)

String imageString = Base64.getEncoder().encodeToString(IOUtils.toByteArray(image.getImageStream()));

return MessageFormat.format("data:{0};base64,{1}", image.getMimeType(), imageString);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by dariobella
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants