fostercommerce / imagerx-imgproxy
Package info
github.com/FosterCommerce/imagerx-imgproxy
Type:craft-plugin
pkg:composer/fostercommerce/imagerx-imgproxy
Requires
- php: ^8.2
- craftcms/cms: ^5.0.0
- fostercommerce/imgproxy: ^1.0
- spacecatninja/imager-x: ^5.1
Requires (Dev)
- fostercommerce/ecs: dev-main
- fostercommerce/rector: dev-main
- phpstan/phpstan: ^1.12
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Important
This package is no longer actively maintained. The Foster Commerce team has transitioned our projects over to Small Pics using their official Imager X transformer.
Imager X Imgproxy Transformer
This module provides an imgproxy transformer for Imager X.
Requirements
- Craft CMS 5.0.0+
- Imager X 5.1.0+
- PHP 8.2+
Installation
composer require fostercommerce/imagerx-imgproxy php craft plugin/install imagerx-imgproxy
Configuration
Add the imgproxy configuration to your Imager X Imgproxy transformer config file (config/imagerx-imgproxy.php):
return [ 'baseUrl' => getenv('IMGPROXY_BASE_URL'), 'key' => getenv('IMGPROXY_KEY') ?: null, 'salt' => getenv('IMGPROXY_SALT') ?: null, 'customSignature' => getenv('IMGPROXY_CUSTOM_SIGNATURE') ?: null, 'encoded' => true, 'defaultParams' => [], ];
Usage
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: '255:0:0',
},
}) %}
Notes
Take a look at the Imgproxy processing options for a list of available options to use in the defaultParams and transformerParams arrays.
This transformer uses fostercommerce/imgproxy under the hood. Take a look there for more usage information.