Provider documentation
Netlify Large Media
Request transformations for images managed by Netlify Large Media.
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 { netlifyLargeMediaProvider } from '@desource/image/providers/netlifyLargeMedia';
export const imageConfig = {
provider: 'netlifyLargeMedia',
providers: {
netlifyLargeMedia: netlifyLargeMediaProvider({
"baseURL": "/"
})
}
} satisfies ImageConfig; Registering this provider makes it the default for the configured components. To mix services, register each
provider and set provider="netlifyLargeMedia" on the image that should use this one.
Image source
Use an image managed by Large Media in the deployed site.
/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="/photo.jpg"
alt="Sample image" width={800} height={500}
modifiers={{
"fit": "fill"
}}
/>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
Width and height map to w and h. Fit contain maps to nf_resize=fit; fill maps to smartcrop. Format is removed from requests.
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
- Auto-detection chooses this provider when NETLIFY_LFS_ORIGIN_URL is present.
- Smart crop requires both width and height. Without both dimensions, the adapter falls back to contain.
- Use netlifyImageCdn for the separate Image CDN endpoint.