Freemarker Base64空白图片

时间:2016-12-14 08:29:13

标签: java base64 freemarker

我需要将图像从java显示到freemarker模板。我将ByteArrayOutputStream转换为bytearray,然后使用org.apache.commons.codec.binary.Base64转换为64。我没有得到任何错误,但图像是空白的。有人可以在freemarker模板或我的代码中说明什么是错误的

爪哇

ByteArrayOutputStream image = null;
SFTPFileTransferFrom st = new SFTPFileTransferFrom();
                image = st.execute(profilePhoto.getImageFilePath(),
                        profilePhoto.getImageFileName(), null);
                is = image.toByteArray();
    byte[] imgBytesAsBase64 = Base64.encodeBase64(is);
            String imgDataAsBase64 = new String(imgBytesAsBase64);
            String imgAsBase64 = "data:image/jpg;base64," + imgDataAsBase64;
rootMap.put("imgAsBase64", imgAsBase64);

FTL

<td rowspan="6" align="center" width="120" style="border:1px solid #ccc;"><img alt="Photo" src="${imgAsBase64}" /></td>

Base64字符串

data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4QA2RXhpZgAASUkqAAgAAAABADIBAgAUAAAAGgAAAAAAAAAyMDA1OjAxOjAxIDAxOjIwOjA1AP/bAEMABgQFBgUEBgYFBgcHBggKEAoKCQkKFA4PDBAXFBgYFxQWFhodJR8aGyMcFhYgLCAjJicpKikZHy0wLSgwJSgpKP/bAEMBBwcHCggKEwoKEygaFhooKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKP/CABEIAkMBzQMBIgACEQEDEQH/xAAcAAEAAgMBAQEAAAAAAAAAAAAAAgQBAwUGBwj/xAAYAQEBAQEBAAAAAAAAAAAAAAAAAQIDBP/aAAwDAQACEAMQAAAB+qAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFUsw8H4c+2VPhUF+vc35ng+h9T5TM+29j882j9BvnP0FNqnAvoyAAAAAAAAAAAAAAAAAAAEYfLjsfOaBZtIy0yM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