Glide images #
Glaze integrates League Glide for on-demand image transformation. Apply transforms by appending query parameters directly to local image URLs – no separate build step required.
Basic usage in Djot content #
Pass Glide parameters as query string values on any local image URL:


This works in both live mode (glaze serve) and build mode (glaze build).
Using presets #
Define named presets in glaze.neon to avoid repeating the same parameters:
images:
driver: gd
presets:
thumb:
w: 320
h: 180
fit: crop
hero:
w: 1200
h: 630
avatar:
w: 80
h: 80
fit: crop
Then reference a preset with ?p=:


The ?preset= key is also accepted as an alias for ?p=.
Raw params and presets can be combined. Raw values take precedence over preset values when both are present:

Using Glide in Sugar templates #
The same URL patterns work in templates. Use the basePath prefix if your site is deployed to a subfolder:
<?php
$base = $site->basePath ?? '';
$imageUrl = $base . '/images/cover.jpg?p=hero';
?>
<img src="<?= $imageUrl ?>" alt="Cover" />
Or inline:
<img
src="<?= ($site->basePath ?? '') . $post->meta['image'] . '?p=thumb' ?>"
alt="<?= $post->title ?>"
/>
You can also hardcode the transform parameters directly:
<img src="/images/cover.jpg?w=800&h=400&fit=crop" alt="Cover" />
Image driver #
Set the image processing driver in glaze.neon:
images:
driver: imagick
Supported values: gd (default), imagick. Most PHP installations include GD. Imagick provides better color profile handling for certain image types.
Live mode behavior #
In glaze serve:
- image requests with Glide params are transformed on demand
-
transformed results are cached under
tmp/cache/glide/ - subsequent requests for the same URL/params are served from cache
-
template cache lives separately under
tmp/cache/sugar/
Build mode behavior #
In glaze build:
- all image URLs with Glide params found in rendered HTML are rewritten
-
transforms are computed and written to
public/_glide/ -
the original source images are also copied to
public/at their original paths
Example:
-
Source URL:
/images/cover.jpg?w=1200&h=500&fit=crop -
Output URL:
/_glide/abc123.jpg(content-hash based name) -
Output file:
public/_glide/abc123.jpg
Notes #
-
Glide only processes local image URLs. External URLs (
https://...) pass through unchanged. - If no Glide params are present in a URL, it is not transformed.
-
Glide supports many parameters beyond
w,h, andfit– see the Glide docs for the full list.