Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (20.3k points)

I'm having trouble displaying a Base64 image inline.

Can someone point me in the right direction?

<!DOCTYPE html>

<html>

  <head>

    <title>Display Image</title>

  </head>

  <body>

    <img style='display:block; width:100px;height:100px;' id='base64image'                 

       src='data:image/jpeg;base64, LzlqLzRBQ...<!-- base64 data -->' />

  </body>

</html>

1 Answer

0 votes
by (40.7k points)

You can try specifying charset like this:

<div>

  <p>Taken from wikpedia</p>

  <img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA

    AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO

        9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

</div>

You can also try the base64 decoder to see if your base64 data is correct or not.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 16, 2019 in Java by Suresh (3.4k points)
0 votes
1 answer

Browse Categories

...