WHAT YOU'LL LEARN
  • what the FileUrlFormatter extension point is and where it applies
  • how to implement and register a custom file URL formatter
  • how to remap query parameters for your own CDN or image service

Overview
anchor

Every image URL rendered inside a FilePicker component in the Webiny admin UI — thumbnails in the Headless CMS field editor, the Website Builder file input, and any custom field that uses FilePicker — passes through the FileUrlFormatter extension point before being displayed.

The default formatter (registered by the File Manager app) appends ?width=128 to the URL so thumbnails are served at a sensible size. You can replace this behaviour entirely: remap the width parameter to your CDN’s own syntax, add authentication tokens, rewrite the host, or apply any other transformation your image delivery pipeline requires.

Only one FileUrlFormatter is active at a time. When you register your own implementation it replaces the File Manager default — the last implementation registered wins.

Implement the Formatter
anchor

Create a class that implements FileUrlFormatter.Interface. The single required method is format(url: URL, params?: FileUrlFormatter.Params): void. Mutate the url object in place — no return value is expected.

params carries the caller’s intent. The width key is the only built-in parameter; any additional keys you pass when calling format are forwarded as-is and your implementation can act on them.

extensions/fileUrlFormatter/MyFileUrlFormatter.ts

Register the Formatter
anchor

Wrap the implementation in a feature and mount it with RegisterFeature:

extensions/fileUrlFormatter/index.tsx

Then add the extension to your webiny.config.tsx:

webiny.config.tsx

How It Works
anchor

When Webiny boots it resolves the active FileUrlFormatter from the DI container and makes it available throughout the admin UI via AdminUiProvider. The FilePicker component’s presenter applies format(url, { width: 128 }) when building its view model, so the formatted URL is already in place before any render component sees it.

ScenarioThumbnail URL
File Manager loaded, no custom formatterhttps://cdn.example.com/img.jpg?width=128
Custom formatter registeredURL transformed by your format implementation
File Manager not loadedURL unchanged

Type Reference
anchor

All types are accessed through the FileUrlFormatter namespace — no direct imports from internal packages needed.

TypeDescription
FileUrlFormatter.InterfaceImplement this in your formatter class
FileUrlFormatter.ParamsType of the params argument: { width?: number; [key: string]: unknown }

Full Example — ReplacingwidthWith a CDN-Specific Parameter
anchor

extensions/fileUrlFormatter/MyFileUrlFormatter.ts