I am currently doing the following to decode base64 images in PHP:
$img = str_replace(\'data:image/jpeg;base64,\', \'\', $s[\'image\']);
$img = str_rep
You can use a regular expression:
$img = preg_replace('#data:image/[^;]+;base64,#', '', $s['image']);
if the text you are replacing is the first text in the image, adding ^
at the beginning of the regexp will make it much faster, because it won't analyze the entire image, just the first few characters:
$img = preg_replace('#^data:image/[^;]+;base64,#', '', $s['image']);