Closed XieWeiJie closed 1 year ago
function svgToImageURI(string memory svg) public pure returns (string memory) { string memory baseURL = "data:image/svg+xml;base64,"; string memory svgBase64Encoded = Base64.encode(bytes(string(abi.encodePacked(svg)))); //string memory svgBase64Encoded = Base64.encode(bytes(svg)); return string(abi.encodePacked(baseURL, svgBase64Encoded)); }
@PatrickAlphaC
You could! The bytes(string(abi.encodePacked(svg))) is leftover from when I had the SVG file combining elements. Sorry!
bytes(string(abi.encodePacked(svg)))
This is the "svgToImageURI" function in the DynamicSvgNft contract
Question : Hey Patrick! Why can't it be used directly like in the comments, taking ”svg“ as a parameter?
@PatrickAlphaC