Provider documentation
Wagtail
Build rendition filter paths for a Wagtail image-serving endpoint.
Setup
Install the framework package and the core package for the provider import:
npm install @desource/image @desource/image-svelte Save this as image.config.ts beside your example component. Replace sample domains and identifiers with
your own.
import type { ImageConfig } from '@desource/image';
import { wagtailProvider } from '@desource/image/providers/wagtail';
export const imageConfig = {
provider: 'wagtail',
providers: {
wagtail: wagtailProvider({
"baseURL": "https://cms.example.com/images"
})
}
} satisfies ImageConfig; Registering this provider makes it the default for the configured components. To mix services, register each
provider and set provider="wagtail" on the image that should use this one.
Image source
Use the image identifier expected by your serving endpoint.
42Usage
The example uses the shared configuration above and the Svelte image component.
<script lang="ts">
import { Image, setImageConfig } from '@desource/image-svelte';
import { imageConfig } from './image.config';
setImageConfig(imageConfig);
</script>
<Image
src="42"
alt="Sample image" width={800} height={500}
modifiers={{
"quality": 80,
"format": "webp",
"focusZoom": 20
}}
/>Provider options
Pass shared defaults such as screens, domains, aliases and presets to the image configuration. Pass provider-specific defaults as modifiers in the provider factory.
Modifiers
Both dimensions generate fill-{width}x{height}-c{focusZoom}. One dimension generates width or height; no dimensions uses original. Format defaults to webp and quality to 70.
Set dimensions on the component and pass service-specific operations through modifiers, as shown
above. See the provider source for exact mappings and the service documentation for accepted values.
Provider notes
- Your backend must implement an endpoint accepting these filter paths. The adapter does not create that route or sign Wagtail serve URLs.
- Use focusZoom to control cropping around the focal area. Generic fit is not read by this adapter.