1. Go to this page and download the library: Download flokosiol/focus 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/ */
flokosiol / focus example snippets
// you need a Kirby image object like this
$image = $page->images()->first();
// crop a square of 200px x 200px
echo $image->focusCrop(200);
// crop a rectangle of 300px x 200px
echo $image->focusCrop(300, 200);
// crop a rectangle of 200px x 400px with a quality of 80%
echo $image->focusCrop(200, 400, ['quality' => 80]);
// crop a grayscale square of 300px x 300px
echo $image->focusCrop(300, 300, ['grayscale' => true]);
// crop a rectangle of 200px x 300px and force coordinates (overrides user input)
echo $image->focusCrop(200, 300, ['focusX' => 0.3, 'focusY' => 0.6]);