thirdweb-example / marketplace-template

Build your own NFT Marketplace with thirdweb SDKs
https://marketplace.thirdweb-preview.com
7 stars 8 forks source link

OnChain NFT Images #15

Closed ryjin111 closed 2 weeks ago

ryjin111 commented 2 weeks ago

Images from OnChain NFTs are not displaying

kien-ngo commented 2 weeks ago

Hey there, your on-chain NFT collection (as we have discussed before), has a metadata format that does not match our conventional NFT metadata. For example:

We are looking for:

{
  image: "data:image/svg+xml;base64,..."
}

You NFT collection:

{
  image_data: "data:image/svg+xml;base64,..."
}

An effective workaround is to add an extra logic around the :

const isOnchain: boolean = ...; 
...
{isOnChain ? 
  <MediaRenderer src={item.metadata['image_data'] .../> : 
  <MediaRenderer src={item.metadata.image} ... />
}
ryjin111 commented 2 weeks ago

@kien-ngo just changing image to image_data works even though there's a error things are working fine src={nft?.metadata.image_data}

kien-ngo commented 2 weeks ago

Hey! Can you share the error message?

ryjin111 commented 2 weeks ago

Hey! Can you share the error message?

image It's working on local dev but uploading to vercel is not

ryjin111 commented 2 weeks ago

More errors detailed image

kien-ngo commented 2 weeks ago

It's coming from TypeScript and not the template. Basically you can do:

item.metadata.image_data as string ?? ""
ryjin111 commented 2 weeks ago

It's coming from TypeScript and not the template. Basically you can do:

item.metadata.image_data as string ?? ""

Awesome it's working now

is my logical expression usage correct? image

ryjin111 commented 2 weeks ago

yoo @kien-ngo update it's working now just need to put away the cosnst isOnchain: Boolean and the logical expression

ryjin111 commented 2 weeks ago

@kien-ngo does the creator fee is automatically included on the selling transaction?

kien-ngo commented 1 week ago

Are you talking about the fees setup for the marketplace contract? You should do that in the thirdweb Dashboard

ryjin111 commented 1 week ago

Are you talking about the fees setup for the marketplace contract? You should do that in the thirdweb Dashboard

When i do the setup

It only uses 1 address on platform fees

Is there way to enable the creator fees?