Skip to content

Console commands ​

Imager X provides three console command groups for generating transforms, clearing caches, and cleaning up expired transforms. All commands are run from your project root using ./craft, ddev craft or php craft.

imager-x/generate PRO ​

Batch generates image transforms based on volumes, folders, or fields. See the Generate documentation for the full list of parameters and examples.

bash
./craft imager-x/generate --volume=images
./craft imager-x/generate -v=images --recursive --queue
./craft imager-x/generate --field=myImage --transforms=small,medium,large

imager-x/clear-caches ​

Clears Imager X caches. Three sub-commands are available:

all ​

Clears both the transforms cache and the remote images runtime cache.

bash
./craft imager-x/clear-caches/all

transforms-cache ​

Clears only the local image transforms cache.

bash
./craft imager-x/clear-caches/transforms-cache

runtime-cache ​

Clears only the remote images runtime cache.

bash
./craft imager-x/clear-caches/runtime-cache

imager-x/clean ​

Scans the local transform cache, identifies files that have exceeded the configured cache duration, and deletes them. When run interactively, you will be prompted to confirm before any files are deleted.

bash
./craft imager-x/clean

Options ​

--volume (shorthand: -v) ​

Handle of the volume to clean transforms for. When omitted, all volumes are scanned.

bash
./craft imager-x/clean --volume=images

--duration (shorthand: -d) ​

Overrides the configured cache duration for this run. Accepts a number of seconds, or any duration string supported by PHP's DateInterval, e.g. P30D for 30 days or PT1H for one hour.

bash
./craft imager-x/clean --duration=P7D
./craft imager-x/clean --duration=604800

--runtimeCache ​

Cleans expired files in the remote images runtime cache instead of the transform cache. The duration defaults to cacheDurationRemoteFiles rather than cacheDuration. The temp, pdf-adapter and video-adapter subpaths are always excluded.

This option cannot be combined with --volume.

bash
./craft imager-x/clean --runtimeCache
./craft imager-x/clean --runtimeCache --duration=P7D

--exclude (shorthand: -e) ​

Comma-separated list of subpaths to exclude, relative to the path being cleaned.

bash
./craft imager-x/clean --exclude=logos,icons
./craft imager-x/clean --volume=images --exclude=logos

Copyright © 2024 André Elvan