Repository navigation
Configuration
Jan Hermann edited this page Oct 9, 2026
·
1 revision
⚙️
Options of the bundle under imagony.thumbnails, their defaults and the registered services.
No configuration file is needed. Create config/packages/imagony.yaml only for the values you want to change. Defaults are defined in Configuration.
imagony:
thumbnails:
base: '%kernel.project_dir%/public/'
folder: '%kernel.project_dir%/public/thumbnails/'
fallback: null
strict: null
flags: ['shrink_only']
formats: []
templates:
blog:
path: 'images/blog/'
height: 250
quality: 80Show the options, or the resulting configuration of your project:
php bin/console config:dump-reference imagony
php bin/console debug:config imagony| Option | Default | Description |
|---|---|---|
base |
%kernel.project_dir%/public/ |
Folder with source images. Paths given to thumbnail() and template path are relative to it. |
folder |
%kernel.project_dir%/public/thumbnails/ |
Folder where thumbnails are generated, it is created when missing. Thumbnail::clean() removes files from it. |
fallback |
null |
Image returned when a source image is missing or can not be processed. null is the built-in placeholder, an own image has to be inside base. |
strict |
null |
Throw when a configured format can not be written by PHP. null follows kernel.debug, see Diagnostics. |
flags |
['shrink_only'] |
Default resize flags: fit, shrink_only, stretch, fill, exact. Flags of a template replace them. |
formats |
[] |
Formats to which every thumbnail is also converted (<thumbnail>.webp, <thumbnail>.avif): webp, avif. See Converters. |
templates |
none | Named sizes used as thumbnail('name', 'image.jpg'). |
| Option | Required | Description |
|---|---|---|
path |
yes | Folder with source images, relative to base. |
width |
no | Missing width or height is calculated from the aspect ratio. |
height |
no | See width. |
flags |
no | Flags for resizing, they replace the default ones. |
quality |
no |
0-100, the driver default when empty. |
- Scalars (
base,folder,fallback,strict) from your file replace the defaults. -
flagsandformatsfrom your file replace the defaults. When they are set in more files (e.g.config/packages/dev/imagony.yaml), the lists are appended. -
templatesare merged by their name, so an environment file can change onlyblog.height.
Registered from services.yaml and console.yaml:
-
Imagony\Thumbnails\Thumbnail(public): receives the configuration, thelogger(if any) andkernel.debug. -
Imagony\Twig\ImagonyExtension: taggedtwig.extension, adds thumbnail(). -
Imagony\EventListener\PlaceholderListener:kernel.requestlistener with priority256, see Placeholder. -
Imagony\Diagnostics\Environment: created byEnvironment::current(). -
Imagony\Commands\CheckCommandandImagony\Commands\CleanCommand: loaded only whensymfony/consoleis installed, see Commands.
The configuration is available as the container parameter imagony.thumbnails.