PHP code example of mullema / k3-image-clip

1. Go to this page and download the library: Download mullema/k3-image-clip 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/ */

    

mullema / k3-image-clip example snippets


if ($image = $page->myimages()->toImage()) {
    echo $image->clip(500);
}

foreach($page->myimages()->toImages() as $image) {
    echo $image->clip(500);
}

if ($image = $page->myimages()->toImage()) {
    echo $image->clip(500);
}

$file->clip(200, 300);   // bestfit
$file->clip(200);        // width 200px
$file->clip(null, 300);  // height 300px
$file->clip();           // clip area without resizing

$file->thumb([
    'width' => 400,
    'clip' => [
       'width' => 500,
       'height' => 200,
       'top' => 10,
       'left' => 200
    ]
]);

if ($image = $page->myimages()->toImage()) {
    echo $image->thumb([
       'width' => 1200,
       'grayscale' => true,
       'clip' => $image->getClip()
    ]);
}
html
 if ($image = $page->myimages()->toImage()):