Course lesson

Add an Image to an NFT with Token Metadata

Let’s add an image to our SVG. We’ll start by creating a base 64 encoded SVG using Base64 and OpenZeppelin.

Duration
7 min
Access
Included
Transcript
Retained from source evidence

Let’s add an image to our SVG. We’ll start by creating a base 64 encoded SVG using Base64 and OpenZeppelin.

Then, in order to actually associate an image to our token, we’ll have to apply it to our token’s metadata. We’ll create a base64 JSON object that includes our image, save it as a string variable that lives in memory, then call the _setTokenURI method with our NFT’s ID and our metadata string.