为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

base64 image not displaying properly

  • 4 个回答
  • 11 人有此问题
  • 1 次查看
  • 最后回复者为 cor-el

more options

I have a small Qt/C++ Program which converts the png images to base64 strings i use that string to display images on my webpage...

this data works fine on Google Chrome and other webkit based browsers but on FireFox it just shows upper part of the image and rest of the image is empty/blank....

is there any special method I have to follow in "< img src = .... / >" tag while displaying the base64 data on fire fox

currently I am doing is < img src =" data:image/png;base64;charset=utf-8,ivr......." / >

I have a small Qt/C++ Program which converts the png images to base64 strings i use that string to display images on my webpage... this data works fine on Google Chrome and other webkit based browsers but on FireFox it just shows upper part of the image and rest of the image is empty/blank.... is there any special method I have to follow in "< img src = .... / >" tag while displaying the base64 data on fire fox currently I am doing is''' < img src =" data:image/png;base64;charset=utf-8,ivr......." / >'''

由abhishekworld于修改

所有回复 (4)

more options

why was the image not displaying properly on facebook?

more options

Does it work if you use: "data:image/png;base64,ivr......." ?

Does that base64 data have embedded line breaks?

Make sure that it is one long line.

You can also try to convert via this online site.

http://www.motobit.com/util/base64-decoder-encoder.asp
more options

This is exactly what I am trying i have a PHP code

post.php http://pastebin.com/WqnwphQq this returns one small xml which contents base64 data ... which I am calling from AJAX post this is my java script http://pastebin.com/C0zppqsR

the output of ele.firstChild.nodeValue is different in firefox and chrome

I can see that the string which we get in firefox is totally change form the actual generated PHP response (I have checked it using firebug )... any pointers ?? i have attached the sample image

more options

Firefox also stores line breaks as text nodes in the DOM, so it is possible that ele.firstChild is a text node and not the node that you expect.
You may need to walk the DOM tree and check that the nodeType is 1 and not 3

You can check that in the DOM Inspector.

DOM Inspector: https://addons.mozilla.org/firefox/addon/6622