Image from bytearray not complete in IE8

给你一囗甜甜゛ 提交于 2019-12-11 12:26:48

问题


Java6, Struts2.2.3.1 - I'm converting a byte array to an image(jpg). Please see the link below, if you open this in IE the image is not complete, whereas it opens fine in Firefox or Chrome

http://jsbin.com/aheliy/2

Java
I encode the bytearray and convert to String using MiGBase64 - where this.bean.imageByteArrayString refers to the form bean

this.bean.setImageByteArrayString(new Base64().encodeToString(imageInByteArr, false));

JSP

<img src="data:image/jpg;base64,<c:out value='${bean.imageByteArrayString}'/>" />

Not sure why this is not working in IE8.


回答1:


IE8 has a 32KB limit on the data URI scheme. See also the wikipedia article on the subject.

I suggest to generate a normal URL instead and have a servlet to serve the image, or if the image is actually already located on the disk file system of the webserver, to create another webapp context so that you can just reference it directly by URL.



来源:https://stackoverflow.com/questions/10576496/image-from-bytearray-not-complete-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!