Sunday 5 May 2013

How to convert image to base64 encoding in php


- Use the following code we can convert the image to base64 encode.



$type = pathinfo($path, PATHINFO_EXTENSION);

$data = file_get_contents($path);

$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);




No comments:

Post a Comment