Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

base64 image not displaying properly

  • 4 replies
  • 11 have this problem
  • 3 views
  • Last reply by 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......." / >'''

Modified by abhishekworld

All Replies (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