![]() |
I think that it should be. |
<?php
function getDataURI($imagePath) { $finfo = new finfo(FILEINFO_MIME_TYPE); $type = $finfo->file($imagePath); return 'data:' . $type . ';base64,' . base64_encode(file_get_contents($imagePath));
}
// Use the above function like below:
echo '<img src="' . getDataURI('https://horje.com/avatar.png') . '" alt="">';
echo '<img src="' . getDataURI('https://horje.com/avatar.png') . '" alt="">';
?>
link base64 |
Type
: |
Develop |
Category
: |
Web Tutorial |
Sub Category
: |
PHP Image Tutorial |
Uploaded by
: |
Admin |
Read Article https://horje.com/learn/1434/reference