Bunny

Provider documentation

Bunny

Generate query transformations for Bunny Optimizer.

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 { bunnyProvider } from '@desource/image/providers/bunny';

export const imageConfig = {
  provider: 'bunny',
  providers: {
    bunny: bunnyProvider({
      "baseURL": "https://your-zone.b-cdn.net"
    })
  }
} satisfies ImageConfig;

Registering this provider makes it the default for the configured components. To mix services, register each provider and set provider="bunny" on the image that should use this one.

Image source

Use a path in the delivery zone or a complete Bunny image URL.

/photo.jpg

Usage

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={{
  "quality": 80
}}
/>

Provider options

baseURL
Your Bunny delivery hostname. Absolute Bunny image URLs may also be passed as src.

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, quality, aspectRatio, crop, cropGravity, flip, flop, blur, sharpen, brightness, saturation and autoOptimize through the query API.

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

  • Enable the image processing service for the delivery zone. Existing query parameters are retained and requested transformations are merged into them.
← Back to all providers