Попробуйте следующее:
file_put_contents('img.png', base64_decode($base64string));
file_put_contents docs