I want to output the embedded jpg image as a base64 encoded string, but when I do this:
$contents = file_get_contents($filename);
print "<img src=\"data:image/jpg;base64,".$contents."\"/>";
Where $filenameis the local text file with base64 image. The output is as follows:
<img src="data:image/jpg;base64,/9j/4A..... (the rest of the file)...." />
And frankly, the image is not displayed, but where does it come from ? It is not in a text file. When deleting, the image is displayed correctly.
source
share