Skip to main content

Function: getTransformedAssetURL()

getTransformedAssetURL(asset, resolution?, format?, quality?): string | undefined

Utility function to generate a transformed URL for an asset. This is used to generate URLs for thumbnails and other transformed versions of an asset. The transformation is done by the asset service and the parameters are passed as query parameters in the URL. The exact transformations that are applied depend on the asset type and the transformations that are configured for it.

Parameters​

asset​

string | Asset

The asset for which a transformed URL is desired.

resolution?​

number = 512

The desired resolution for the asset. This is a hint that may or may not be respected depending on the asset type and the transformations that are configured for it.

format?​

"jpg" | "png" | "webp"

quality?​

number

The desired quality for the asset. This is a hint that may or may not be respected depending on the asset type and the transformations that are configured for it.

Returns​

string | undefined

The transformed URL for the asset or undefined if the asset does not have a file link.