1. Go to this page and download the library: Download arnoson/kirby-auto-srcset 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/ */
// your-template.php
$srcset = $image->autoSrcset([
'minWidth' => 300,
'maxWidth' => 1000,
// in kb
'fileSizeStep' => 20,
// The maximum number of images to be created.
'maxSteps' => 10,
// An optional ratio that is used to crop the image.
'ratio' => 16 / 9,
// Options to pass to kirby's `$file->thumb()` method.
'thumb' => [
'quality' => 80,
'format' => 'jpeg',
'crop' => 'center',
// ...
],
]);