smallpics/imagerx-smallpics

SmallPics transformer for Imager X

dev-main 2025-08-02 20:42 UTC

This package is auto-updated.

Last update: 2025-08-02 20:42:45 UTC


README

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 smallpics/imagerx-smallpics
php craft plugin/install imagerx-smallpics

Configuration

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' => [],
];

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: 'ff0000',
    border: {
      width: 10,
      color: '000000',
      borderMethod: 'overlay',
    }
  },
}) %}

Notes

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.