Glide

Provider documentation

Glide

Generate transformation URLs for a PHP Glide image server.

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

export const imageConfig = {
  provider: 'glide',
  providers: {
    glide: glideProvider({
      "baseURL": "https://images.example.com"
    })
  }
} satisfies ImageConfig;

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

Image source

Use the image path expected by your Glide server.

/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,
  "format": "webp",
  "fit": "cover"
}}
/>

Provider options

baseURL
The URL where your Glide server accepts image paths.

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, format, fit, orientation, flip, crop, dpr, blur, sharpen via sharp, brightness via bri, contrast via con, watermarks via mark and background.

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

  • Fit maps cover to crop, inside to max, outside to stretch, and contain to contain.
  • The adapter does not create a Glide server or URL signature. If your server requires signatures, generate the final signed URL on your server.
← Back to all providers