PHP Classes

File: docs/content/examples/creating-figures.md

Recommend this page to a friend!
  Classes of Jose Luis Quintana   GImage PHP Canvas to Image   docs/content/examples/creating-figures.md   Download  
File: docs/content/examples/creating-figures.md
Role: Example script
Content type: text/markdown
Description: Example script
Class: GImage PHP Canvas to Image
Create and compose canvas images from other images
Author: By
Last change:
Date: 1 year ago
Size: 559 bytes
 

Contents

Class file image Download

Creating figures

The Figure class supports two kind of figures like rectangles and ellipses.

!!! tip "Note"

A figure is a rectangle by default.

Rectangle

<?php

use GImage\Figure;

$figure = new Figure(350, 200);
$figure
    // ->isRectangle()
    ->setBackgroundColor(255, 0, 0)
    ->create()
    ->save('rectangle.png');

Ellipse

<?php

use GImage\Figure;

$figure = new Figure(200, 200);
$figure
    ->isEllipse()
    ->setBackgroundColor(0, 255, 255)
    ->setOpacity(0.5)
    ->create()
    ->save('ellipse.png');