Post-processing Images

Slot: afterImageResize

This slot is used to post-process the resized image.

Your slot should implement a method of the form:

public function postProcessImageResize($operation, $source, $destination,
                                       &$newWidth, &$newHeight)
{
    // Custom code
}

Parameter $operation is either RESIZE if $source was resized or RESIZE_CONVERT if $source was first resized and then converted to another file format.

Registering the slots

In your extension, open EXT:extension-key/ext_localconf.php and add:

/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
    \TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class
);

$signalSlotDispatcher->connect(
    \Causal\ImageAutoresize\Service\ImageResizer::class,
    'afterImageResize',
    \Company\MyExt\Slots\ImageAutoresize::class,
    'postProcessImageResize'
);