PHP code example of nerdcel / kirby3-responsive-images

1. Go to this page and download the library: Download nerdcel/kirby3-responsive-images 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/ */

    

nerdcel / kirby3-responsive-images example snippets


 responsiveImage(string 'teaser-home-cover', File $page->cover(), string 'optional-css-class', bool true, string 'Alt text', string 'webp');  

'nerdcel.responsive-images' => [
    'cache' => true,
    'configPath' => kirby()->root('content'),
    'configFile' => 'responsive-img.json',
    'quality' => 75,
    'defaultWidth' => 1024,
    'allowedRoles' => [
        'admin'
    ],
    'cropDriver' => function ($file, $options) {
        return $file->focusCrop(
            $options['width'],
            $options['height'],
            [
                'quality' => $options['quality'],
                'upscale' => $options['upscale'],
                'format' => $options['format'],
            ]
        );
    }
]

function (File $file, array $options) {
    // do something with the file and return it
}