tquang
tquang

Reputation: 613

HTML images with base64

Like as the title of thread, I need to know way to insert images into web page HTML, the images will be encrypted base64. I found this example code

<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSU" />

But I don't want this, I need more complex like:

<img alt="Embedded Image" src="data:image/png;base64,/path/to/file.txt" />

The file.txt is file containes base64 code. Thanks!

Upvotes: 0

Views: 88

Answers (1)

Justinas
Justinas

Reputation: 43481

You need some programming language that can read file, e.g. PHP:

<img alt="Embedded Image" src="data:image/png;base64,<?= file_get_contents('/path/to/file.txt'); ?>" />

Upvotes: 1

Related Questions