Custom modifiers 

The predefined modifiers are not enough for your use case? No problem! You can easily write your own.

Implement your own image modifier by extending the AbstractModifier class and implementing the ModifierInterface method.

Classes/Image/Modifier/CustomModifier.php
<?php

namespace Vendor\YourExt\Image\Modifier;

use Intervention\Image\Interfaces\ImageInterface;
use KonradMichalik\Typo3EnvironmentIndicator\Image\Modifier\AbstractModifier;
use KonradMichalik\Typo3EnvironmentIndicator\Image\Modifier\ModifierInterface;

class CustomModifier extends AbstractModifier implements ModifierInterface {

    public function modify(ImageInterface &$image): void
    {
        // Modify the image using $this->configuration
    }

    public function validateConfigurationWithErrors(array $configuration): array
    {
        $errors = [];

        if (!isset($configuration['myRequiredKey'])) {
            $errors[] = 'Missing required configuration key: myRequiredKey';
        }

        return [
            'valid' => [] === $errors,
            'errors' => $errors,
        ];
    }
}
Copied!

See the Intervention Image documentation for more information about image manipulation.

The AbstractModifier merges the defaults from $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['typo3_environment_indicator']['defaults'] for your class into the configuration, validates it with validateConfigurationWithErrors() and throws an InvalidArgumentException if it is invalid.