webd97/chameleon

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP image manipulation library built around GD

dev-master 2018-01-14 17:50 UTC

This package is not auto-updated.

Last update: 2020-08-22 06:06:05 UTC


README

Chameleon is a PHP image manipulation library built around GD.

Please note that it is still in development!

Code example

<?php
    require __DIR__ . "/vendor/autoload.php";

    use Chameleon\Image;
    use Chameleon\Vector2;

    use Chameleon\Colors\HSLColor;
    use Chameleon\Primitives\Rectangle;
    use Chameleon\Patterns\BackgroundColor;

    $image = Image::create(480, 360);

    $imageBackground = new HSLColor(135, 1, 0.3);

    $image -> setBackgroundPattern(new BackgroundColor($imageBackground));

    $rectanglePosition = new Vector2(50, 50);
    $rectangleBackground = new HSLColor(45, 1, 0.5);
    $rectangleBorder = new HSLColor(90, 1, 0.8);

    $rectangle = new Rectangle($rectanglePosition, 380, 260);
    $rectangle -> setBackgroundPattern(new BackgroundColor($rectangleBackground))
               -> setBorderPattern(new BackgroundColor($rectangleBorder))
               -> setBorderThickness(5);

    $image -> draw($rectangle);

    header("Content-type: image/png");
    $image -> outputFile(IMG_PNG);
?>

Output

PHP Output