来自bytearray的图像在IE8中不完整 [英] Image from bytearray not complete in IE8

查看:81
本文介绍了来自bytearray的图像在IE8中不完整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java6,Struts2.2.3.1-我正在将字节数组转换为图像(jpg).请查看下面的链接,如果您在IE中打开该图片,则该图片不完整,而在Firefox或Chrome中可以正常打开

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
我对字节数组进行编码,然后使用 MiGBase64 转换为String-其中this.bean.imageByteArrayString表示形式为bean

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}'/>" />

不确定为什么它不能在IE8中工作.

Not sure why this is not working in IE8.

推荐答案

IE8的数据URI方案限制为32KB.另请参见关于该主题的维基百科文章.

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

我建议改为生成一个普通的URL并使用一个servlet来提供图像,或者如果该图像实际上已经位于Web服务器的磁盘文件系统上,则可以创建另一个Webapp上下文,以便您可以直接引用它通过URL.

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.

这篇关于来自bytearray的图像在IE8中不完整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆