PHP code example of bavix / glow-kit

1. Go to this page and download the library: Download bavix/glow-kit 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/ */

    

bavix / glow-kit example snippets


use Intervention\Image\ImageManagerStatic;
use Bavix\Glow\Adapters\Fit;

$adapter = new Fit(ImageManagerStatic::getManager());
$image = ImageManagerStatic::make(__DIR__ . '/image.jpg');
$result = $adapter->apply($image, [
    'width' => '300',
    'height' => '300',
]);

$result->save(__DIR__ . '/output.jpg');

use Intervention\Image\ImageManagerStatic;
use Bavix\Glow\Adapters\Contain;

$adapter = new Contain(ImageManagerStatic::getManager());
$image = ImageManagerStatic::make(__DIR__ . '/image.jpg');
$result = $adapter->apply($image, [
    'width' => '300',
    'height' => '300',
]);

$result->save(__DIR__ . '/output.jpg');

use Intervention\Image\ImageManagerStatic;
use Bavix\Glow\Adapters\Cover;

$adapter = new Cover(ImageManagerStatic::getManager());
$image = ImageManagerStatic::make(__DIR__ . '/image.jpg');
$result = $adapter->apply($image, [
    'width' => '300',
    'height' => '300',
]);

$result->save(__DIR__ . '/output.jpg');