Image to base64 encoding issue – PHP

By | October 30, 2018
Questions:
<?php
   header("Content-type: image/jpeg;charset=utf-8'");
   $path = 'example/source.jpg';
   $da = file_get_contents($path);

   $base64 = base64_encode($da);
   $src = 'data:image/jpeg;charset=utf-8;base64,'.$base64;
   echo '<img src="'.$src.'">';

?>

php v5.6.2

I tired copying the $src value in debug and pasted in img src value. still its not showing up.

what did i missed here?.

thanks in advance

Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *