Function to save base64 image to png with PHP