Provider documentation
Umbraco
Generate ImageSharp query commands for Umbraco media assets.
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 { umbracoProvider } from '@desource/image/providers/umbraco';
export const imageConfig = {
provider: 'umbraco',
providers: {
umbraco: umbracoProvider({
"baseURL": "https://cms.example.com"
})
}
} satisfies ImageConfig; Registering this provider makes it the default for the configured components. To mix services, register each
provider and set provider="umbraco" on the image that should use this one.
Image source
Use the complete /media/... path.
/media/asset-id/photo.jpgUsage
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="/media/asset-id/photo.jpg"
alt="Sample image" width={800} height={500}
modifiers={{
"quality": 80,
"format": "webp",
"fit": "cover",
"focalPointXY": "0.55,0.58"
}}
/>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
Supports width, height, format, quality, fit, sampler, anchorPosition and focalPointXY. Fit contain becomes max; cover becomes crop. A focal point is an x,y pair between 0 and 1.
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
- Set crops are not implemented. The adapter does not generate HMAC signatures for protected imaging endpoints.
- Umbraco imaging configuration can cap allowed resize dimensions.
- Use sampler for ImageSharp resampling and anchorPosition for an edge or corner crop anchor.