Skip to content

Commit

Permalink
Add base64 image support with docx rendering (#397)
Browse files Browse the repository at this point in the history
issue-257
  • Loading branch information
Xaelis authored Apr 10, 2020
1 parent 052a1f7 commit 5a3cd8a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,10 @@ private R renderImage(DocxRendererContext docx, String url, Attributes attribute
url = this.getClass().getResource("/emoji/" + url.substring(DocxRenderer.EMOJI_RESOURCE_PREFIX.length())).toString();
}

if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) {

if (ImageUtils.isEncodedImage(url)) {
image = ImageUtils.base64Decode(url);
} else if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) {
// hyperlinked image or file
if (url.startsWith("file:")) {
// try to load from file, from URL fails on some images while file load succeeds
Expand Down

0 comments on commit 5a3cd8a

Please sign in to comment.