I suspect the problem is with the actual Base64 data. Otherwise it looks good to me. See this fiddle where a similar scheme is working. You may try specifying the character set.
<div>
<p>Taken from wikpedia</p>
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
</div>
Run code snippetEdit code snippet Hide Results Copy to answer Expand
You can try this Base64 decoder to see whether your Base64 data is correct or not.
Answer from VinayC on Stack OverflowI suspect the problem is with the actual Base64 data. Otherwise it looks good to me. See this fiddle where a similar scheme is working. You may try specifying the character set.
<div>
<p>Taken from wikpedia</p>
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
</div>
Run code snippetEdit code snippet Hide Results Copy to answer Expand
You can try this Base64 decoder to see whether your Base64 data is correct or not.
You need to specify the correct Content-type, Content-encoding and charset.
Like
data:image/jpeg;charset=utf-8;base64,
according to the syntax of the data URI scheme:
data:[<media type>][;charset=<character set>][;base64],<data>
Render HTML Base64 images
Base64 Image not displaying as an image
Displaying a BASE64 image from the address bar as HTML
Create PNG from base64 encoded html.Img src
Sorry if this doesn't make sense. I'm not a webdev and am learning as I go.
I found an app to convert a GIF into a BASE64 image, and can display that image directly in a browser from the address bar:
data:image/webp;base64,UklGRkoBAABXRUJQVlA4ID4BAABQGQCdASoAAQABPmk0mk0hkQj4FANAbuF0ZgEtoORb8gfQOSPZX+2EgESEaTOSPZ6DxKSajiULSzpGo4lJNDzXQeJSTUcK5r8qGlHjl2D9vhlNxaqqqqqqqqqoL6VDSjxy7B/jQpFZdgjdfIZuvkMxg0br5DN18hm6+QzdLRAHczR3KfRt3MFQHcsDcSANwYmceQBWXYI3XyGbpby08Bm6+QzdfIZuvb23VLW0APFyIwSGyg8MoGZ1CWupEZTcWqqqqqFAEjCoBJNQpYdi80ajiUIAAP7+Esv2C28v//g1vuG/VBMAAAAZ65KNgQJL55Z9Kf7wVb1kgNzlgIUCZkIXounFlBEEAAAAXasZLom8qUayYpxZQNd/OqdYmNk1M4YgqR+3YuyBsC8XmKKxMjcoxBenFECuAAAAAAAAAAA=
However, is there a way to either plug this into a <script> tag, or force something to read it as HTML? The particular instance would be plugging this in as an HTML address on an NFC card or QR code, so when that's scanned it just displays the BASE64 image in the browser as opposed to going to a website. If I just put that in an address field on either one of those media, the iPhone will say "no valid data" because it's looking for the https.
Then, if there is a way to do this, is there a way to resize it from that same syntax in the browser? Like, if it was a 128x128px image, is there syntax to tell the browser to display it at 600x600?
Thank you in advance!