PHP code example of superbig / craft-imagerpretransform
1. Go to this page and download the library: Download superbig/craft-imagerpretransform library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
superbig / craft-imagerpretransform example snippets
return [
// Toggle pretransforming as needed
'enabled' => true,
// This will process each image in a separate job. Perfect in combination with Async Queue.
'processImagesInJobs' => false,
// Transforms - these options are passed straight to Imager
'transforms' => [
// Global transform, will be applied to all images
[
'width' => 1400,
],
// Images source, with handle images
'images' => [
[
'width' => 1400,
],
[
'width' => 600,
'jpegQuality' => 65
],
[
'width' => 380,
'height' => 380,
'mode' => 'crop',
'position' => 'center-center',
'jpegQuality' => 65
],
'defaults' => [
],
'configOverrides' => [
'resizeFilter' => 'catrom',
'instanceReuseEnabled' => true,
]
],
'anotherSourceHandle' => [
[
'height' => 600
]
]
]
];