This module provides an imgproxy transformer for Imager X.
- Craft CMS 5.0.0+
- Imager X 5.1.0+
- PHP 8.2+
composer require smallpics/imagerx-smallpics
php craft plugin/install imagerx-smallpics
Add the smallpics configuration to your Imager X SmallPics transformer config file (config/imagerx-smallpics.php
):
return [
'baseUrl' => getenv('SMALLPICS_BASE_URL'),
'secret' => getenv('SMALLPICS_SECRET') ?: null,
'defaultParams' => [],
];
Once installed and configured, you can use the transformer with Imager X:
{% set transformedImages = craft.imagerx.transformImage(rawImage, [
{ width: 74, height: 74 },
{ width: 120, height: 120 },
{ width: 172, height: 172 },
{ width: 254, height: 254 }
], {
mode: 'crop',
transformerParams: {
padding: 10,
background: 'ff0000',
border: {
width: 10,
color: '000000',
borderMethod: 'overlay',
}
},
}) %}
Take a look at the SmallPics processing options for a list of available options to use in the defaultParams
and transformerParams
arrays.
This transformer uses smallpics/smallpics-php under the hood. Take a look there for more usage information.