Configuration
You can customise Image Resizer’s settings using a PHP configuration file. This is optional: each setting has a default, so you only need to include the values you want to change.
To override a setting, create image-resizer.php in your Craft project’s /config directory and return an array of setting names and values. For example, the following will set the global image width to 1600 pixels:
<?php
return [
'imageWidth' => 1600,
];All other settings keep their defaults. Add any further settings you want to change to the same array. The options below explain the available settings and their defaults. You can also manage many of these settings in the control panel under Settings → Image Resizer.
Configuration Options
Whether to use the "global" top-level settings, or per-asset source.
Whether to enable the plugin.
The maximum width in pixels allowed for uploaded images.
The maximum height in pixels allowed for uploaded images.
=> Enter a value from 0-100 for resized image quality.
Image Resizer checks each source image against the following global safety limits before decoding it. These limits apply to automatic, bulk, and console resizing. An image that exceeds a limit is left unchanged and recorded as skipped in the resize log.
The maximum source image file size, in bytes, that Image Resizer will process. The default is 100 MiB.
This is a global safety limit and cannot be configured per volume.
The maximum source image width or height, in pixels, that Image Resizer will process.
This is a global safety limit and cannot be configured per volume.
The maximum total source image pixel count that Image Resizer will process. The default is 50 megapixels.
This is a global safety limit and cannot be configured per volume.
Whether to skip resulting larger images.
Whether to save a pre-resize copy in an originals folder. Upload backups follow Craft’s configured image sanitisation and metadata settings.
Provide enabled, imageWidth, imageHeight, and imageQuality as an array, keyed by the volume ID. Ensure that you set useGlobalSettings to false.
Setting the useGlobalSettings to true will ignore any settings defined in assetSourceSettings, and rely on the top-level enabled, imageWidth, imageHeight, etc.
<?php
return [
'*' => [
'useGlobalSettings' => true,
'enabled' => true,
'imageWidth' => 2048,
'imageHeight' => 2048,
// Any settings here will be ignored.
'assetSourceSettings' => [
// ...
],
]
];Setting the useGlobalSettings to false will ignore the top-level settings, and instead rely on settings in the assetSourceSettings setting.
<?php
return [
'*' => [
'useGlobalSettings' => false,
// These are ignored, instead use `assetSourceSettings`
'enabled' => true,
'imageWidth' => 2048,
'imageHeight' => 2048,
'assetSourceSettings' => [
'1' => [
'enabled' => true,
'imageWidth' => 2048,
'imageHeight' => 2048,
],
'2' => [
'enabled' => true,
'imageWidth' => 2048,
'imageHeight' => 2048,
],
// ...
],
]
];