I'm doing a chat with ajax and it's not easy to use data64 to make the chat lighter and so you can not see the file path example ./uploads/5rtfgygyg-image.png
$image = 'myimage.png';
$type = pathinfo($image, PATHINFO_EXTENSION);
$data = file_get_contents($image);
$dataUri = 'data:image/' . $type . ';base64,' . base64_encode($data);