@60fps/ui-image v0.0.1

API reference

Every option, token and export. New here? Start with the guide.

Options#

For getResponsiveImage(image, options), getResponsiveImageAsync and createImageHelper. Everything is optional.

Returned data#

A plain object. You can compute it on the server and send it to the client.

URL tokens#

Replaced in src and proxy templates. A query param whose token has no value is removed. A missing value in the path throws an error that says what to add.

Image inputs#

What getResponsiveImage accepts as its first argument.

Rendering#

renderPicture(image, options) and imgAttributes(image, options).

Custom resolver#

When no template fits (signed URLs, for example), build every URL yourself. It may return a promise with getResponsiveImageAsync.

Vite plugin#

responsiveImages(options) from @60fps/ui-image/vite. Needs sharp.

sharpResolver#

sharpResolver(options) from @60fps/ui-image/sharp. Use it as proxy (plain URLs only) or resolver (every image).

imageMiddleware#

imageMiddleware(options) from @60fps/ui-image/sharp. Serves /_ui-image?url=…&w=…&h=…&f=…&q=…. Point images at it with proxy: imageEndpoint().

All exports#

Back Guide ← Quick start, recipes and good practices