Because NFTs are usually stored and served by IPFS or third-party servers, ensuring that media loads quickly and reliably within your product can be difficult. BlockSpan caches supported NFT images and videos and delivers them through a CDN in order to provide the best user experience possible. The cache also supports the option to return an optimized version of the original file up to 90% smaller size as described below. We currently support the following media types:

Media TypeExtension
'image/png'png
'image/jpeg', 'image/jpg'jpg
'image/gif'gif
'image/svg+xml', 'image/svg'svg
'image/tiff', 'image/tif'tif
'image/avif'avif
'image/webp'webp
'video/mp4'mp4

For images, the cached image urls are returned within the cached_images field of the Token object as shown below. For convenience, we return multiple urls scaled to fit the following max dimensions: tiny 100px, small 250 px, medium 500 px, large 1000 px, and the image in the original size. If you need further customization for the dimension, simply take one of the returned url and replace with your custom dimension such as _756_756. No additional API call needed. Please note, the max dimension will be limited based on the size of the original image.

For mp4 videos, cached_videos will contain the link to the cached mp4 file and cached_images will contain multiple urls to scaled screenshot for convenience.

Note: Using scaling for formats such as gif is unpredictable as it shows only the first frame with no animation

📘

"cached_videos":
{
"original": "https://cdn.blockspan.com/53616c7465645f5f28b.................................996236c29d8d.mpg"
},
"cached_images": r]
{
"title": "Optimized Image upto 90% size reduction"
}
[/block]

📘

Want an optimized version of the image at any size? Simply append _optimized as follows:

.................................996236c29d8d_500_500_optimized.png"
We compress the image into mime type jpeg with file size reduction upto 90% depending on the original image format.
Note: Recommended mostly for png images which benefit the most from compression. May not be worth it for other formats which could lose some features such as gif and svg

Optimized Image upto 90% size reduction

📘

Want an optimized version of the image at any size? Simply append _optimized as follows:
.................................996236c29d8d_500_500_optimized.png"
We compress the image into mime type jpeg with file size reduction upto 90% depending on the original image format.
Note: Recommended mostly for png images which benefit the most from compression. May not be worth it for other formats which could lose some features such as gif and svg