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, videos, audio files etc., and delivers them through a CDN in order to provide the best user experience possible. We currently support the following media types:

Images

image/avif
image/gif
image/heic
image/jpeg
image/jpg
image/png
image/svg
image/svg+xml
image/tiff
image/webp
image/x-png

Videos

video/3gpp
video/mp4
video/quicktime
video/webm
video/x-m4v
video/x-matroska

Other Assets

audio/aiff
audio/mpeg
audio/wav
audio/wave
audio/x-m4a
audio/x-wav

application/json
application/octet-stream
application/pdf
application/vnd.apple.mpegurl
application/x-www-form-urlencoded
binary/octet-stream
model/gltf-binary
text/html
text/plain


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.

    "cached_images": {
        "tiny_100_100": "https://cdn.blockspan.com/53616....760b42ba5f1fd23593a_100_100.jpg",
        "small_250_250": "https://cdn.blockspan.com/53616....60b42ba5f1fd23593a_250_250.jpg",
        "medium_500_500": "https://cdn.blockspan.com/53616....0b42ba5f1fd23593a_500_500.jpg",
        "large_1000_1000": "https://cdn.blockspan.com/53616....2ba5f1fd23593a_1000_1000.jpg",
        "original": "https://cdn.blockspan.com/53616c74656....269298760b42ba5f1fd23593a.jpg",
        "content_type": "image/jpeg"
    }

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.

    "cached_videos": {
        "original": "https://cdn.blockspan.com/53616....5e79cf84f29ebe42d96e80791e44450.mp4",
        "content_type": "video/mp4"
    },
    "cached_images": {
        "tiny_100_100": "https://cdn.blockspan.com/53616.......44450_screenshot_100_100.jpg",
        "small_250_250": "https://cdn.blockspan.com/53616......44450_screenshot_250_250.jpg",
        "medium_500_500": "https://cdn.blockspan.com/53616c....44450_screenshot_500_500.jpg",
        "large_1000_1000": "https://cdn.blockspan.com/53616....44450_screenshot_1000_1000.jpg",
        "original": "https://cdn.blockspan.com/53616c746564....44450_screenshot.jpg",
        "content_type": "video/mp4"
    },

For audio files and all other media formats , cached_other assets will be an array containing one or more json objects with details of the corresponding cached media files. Note: Some NFTs have multiple media files

    "cached_other_assets": [
        {
            "original": "https://cdn.blockspan.com/53616c....2a4c15950cfc05321b3f1cfd83291c.mov",
            "content_type": "video/quicktime"
        },
        {
            "original": "https://cdn.blockspan.com/53616c....54676578823df2cfa99173df703e8f2a18",
            "content_type": "audio/wav"
        },
        {
            "original": "https://cdn.blockspan.com/53616c....8976505e39e4b82e62dda4c43219fa3208",
            "content_type": "text/html"
        }
    ]

The cache also supports the option to return an optimized version of the original file up to 90% smaller size as described below.

📘

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