system.resizer.afterResize
Enables post processing of resized images after they've been resized before the
resizing process is finalized (ex. adding watermarks, further optimizing, etc)
Example usage:
Event::listen('system.resizer.afterResize', function ((\System\Classes\ImageResizer) $resizer, (string) $localTempPath) { // Get the resized image data $resizedImageContents = file_get_contents($localTempPath);
// Post process the image
$processedContents = TinyPNG::optimize($resizedImageContents);
// Place the processed image in the correct location for the resizer to finish processing it
file_put_contents($localTempPath, $processedContents);
});
Usage
Triggers
Class or file | Line |
---|---|
System\Classes\ImageResizer
|
324 |
Copyright © 2024 Winter CMS