webD97 / chameleon

A PHP image manipulation library built around GD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chameleon Build Status Code Climate Test Coverage

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

About

A PHP image manipulation library built around GD

License:MIT License


Languages

Language:PHP 99.8%Language:Shell 0.2%