DEPRECATION WARNING

This documentation is not using the current rendering mechanism and will be deleted by December 31st, 2020. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

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\ImageResizer::class,
    'postProcessImageResize'
);