Saturday, June 6, 2020

Image 64 decode script in php

$path = 'myfolder/myimage.png';

$type = pathinfo($path, PATHINFO_EXTENSION);

$data = file_get_contents($path);

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

No comments:

Post a Comment