显示图像,采用base64字符串格式 [英] display an image,which is in base64 string format

查看:344
本文介绍了显示图像,采用base64字符串格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须显示一个base64字符串格式的图像。它在ie9,chrome和mozilla中工作得很好。但是当使用ie8图像时不能完全显示。

I have to display an image,which is in base64 string format. It's working fine in ie9,chrome and mozilla.But when using ie8 image is not completly displaying.

推荐答案

你无法修复IE8,对吗? :-)



然后你有两种方法:

You cannot fix IE8, right? :-)

Then you have two ways:
  1. 修复你的代码以支持更广泛的浏览器。如果你的嵌入式base64图像的实现没有被错误地实现(我不知道它是如何不正确的,因为我看不到你的代码),修复它。如果无法完成,请选择常规图像文件。
  2. 拒绝某些您不想支持的浏览器。比如,如果您检测到浏览器是IE8,请显示一条消息,建议升级此浏览器或使用其他浏览器。你可以找到很好的拒绝实现,例如:

    http://jreject.turnwheel.com [ ^ ]。
  1. Fix your code the way supporting wider set of browser. If your implementation of the embedded base64 image is not incorrectly implemented (I have no idea how it could be incorrect as I cannot see your code), fix it. If it cannot be done, opt for the regular image file.
  2. Reject some browsers you don't want to support. Say, if you detect that the browser is IE8, show a message recommending to upgrade this browser or use other browsers. You can find nice implementation of rejection, for example, here:
    http://jreject.turnwheel.com[^].





如果你想使用方法#1,你可能不喜欢单独的图像文件,因为你可能会关注图像热链接

http://en.wikipedia.org/wiki/Inline_linking [ ^ ]。



这将是一个单独的问题有不同的解决方案。例如,可以使用.htaccess文件或使用一种或另一种服务器端技术在HTTP响应中动态生成图像内容来完成。由于我不知道你在服务器端有什么,尝试自己找到解决方案,或者提出一些进一步的问题,提供有关资源的更多信息。请参阅: http://bit.ly/1nk2tCA [ ^ ]。



-SA



If you want to use approach #1, you may dislike the idea of a separate image file because you might be concerned with image hotlinking:
http://en.wikipedia.org/wiki/Inline_linking[^].

This would be a separate problem which has different solutions. For example, it can be done using ".htaccess" file or dynamic generation of the image content in HTTP response using one or another server-side technology. As I have no idea on what you have on server side, try to find the solution yourself, or ask some further question providing more information on your resources. Please see: http://bit.ly/1nk2tCA[^].

—SA


这篇关于显示图像,采用base64字符串格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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