/api/media/{photoId} with your transform params as query string. On first access the server processes the image and caches the result permanently. Subsequent requests return the cached file.
This is the only SDK method that does not make a network request. It builds and returns a string immediately.
Parameters
string
required
UUID of the photo. Obtain it from
getPhotos() or getCollection().MediaUrlOptions
Optional transform options. Server defaults apply when omitted.
MediaUrlOptions
number
Target width in pixels (1–5000). Height scales proportionally unless
h is also set.number
Target height in pixels (1–5000). Width scales proportionally unless
w is also set.string
default:"webp"
Output format. One of
webp, jpeg, or avif.number
default:85
Quality from 1 (lowest) to 100 (highest).
string
default:"cover"
Scaling mode when both
w and h are provided.Returns
A URL string, for example:Examples
transforms.ts
Caching
The server stores the transformed image after the first request. All subsequent calls with the same params skip processing entirely.Pre-generated versions vs. getMediaUrl
Pre-generated URLs are always fastest for their target sizes. Use
getMediaUrl only when the three built-in versions don’t cover your case.