How do I use the TLCDN?

The Transloadit Content Delivery Network (TLCDN) is a Smart CDN that allows you to dynamically transform and deliver your media files, such as images, videos, and documents, in real-time. Here's how you can use the TLCDN:

Hosting Your Files

Store your original files in your own cloud storage solution, such as an Amazon S3 bucket.

Creating a Template

Create a Transloadit Template that defines the importing, transcoding, and delivery instructions for your media files. This Template can include various Robots (e.g. /image/resize, /document/convert) and their respective settings. We've included a basic image transformation Template below.

{
  "steps": {
    "imported": {
      "robot": "/s3/import",
      "credentials": "my-s3-credentials",
      "path": "/images/${fields.input}"
    },
    "resized": {
      "use": "imported",
      "robot": "/image/resize",
      "width": "${fields.w}"
    },
    "served": {
      "use": "resized",
      "robot": "/file/serve"
    }
  }
}

In your Template, you can use Assembly Variables (e.g., ${fields.w}) to adjust the transformation settings based on the query parameters passed via the TLCDN URL.

Requesting Transformations

To request a transformation, construct a TLCDN URL using the following format:

https://[your-workspace].tlcdn.com/[template-name]/[file-path]?[parameters]

When a user requests this URL, the TLCDN will fetch the original file from your cloud storage, apply the transformations specified in your Template (using the provided parameters), and serve the transformed file.

Be sure to replace:

  • your-workspace with your Transloadit Workspace name
  • template-name with the name of your Template
  • file-path with the path to the file you want to transform
  • parameters with the desired transformation parameters (e.g. ?w=730 for setting the width to 730 pixels)

The URL can optionally be extended with an expiration time and signature to prevent outsiders from tampering with the URL and its parameters. For more details on how to generate a correctly hashed signature, take a look at our detailed guide.

When it's all pieced together, you can end up with the same snappy transformations as the demo below.

 
 

See also:

Will there be any surprises after I sign up? What formats and codecs does Transloadit support? How can I track uploads for a specific user?