file to base64 code example
Example 1: php image to base64
$path = 'myfolder/myimage.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
Example 2: echo encode base64
$ echo 'linuxhint.com' | base64