in reply to Substituting base64 encoded text

When you verified that $base64_image is the same as in SVG, are you checked that they have the same line endings?