bavix/glow-kit

A set for working with an image

2.0.0 2020-08-31 15:16 UTC

This package is auto-updated.

Last update: 2022-09-29 03:02:41 UTC


README

Glow Kit

Mutation testing badge Package Rank Latest Stable Version Latest Unstable Version License

glow-kit - A set for working with an image.

  • Vendor: bavix
  • Package: glow-kit
  • Version: Latest Stable Version
  • PHP Version: 7.3+
  • Composer: composer require bavix/glow-kit

Get started

The library implements simple algorithms for working with images.

  • Scale Down
  • Contain
  • Cover
  • Fit

Fit Image

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');

Contain Image

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');

Cover Image

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');

Supported by

Supported by JetBrains