PHP Classes
elePHPant
Icontem

File: docs/classes/figure.md

Recommend this page to a friend!
  Classes of Jose Luis Quintana  >  GImage  >  docs/classes/figure.md  >  Download  
File: docs/classes/figure.md
Role: Example script
Content type: text/markdown
Description: Example script
Class: GImage
Create graphic images with a fluent interface
Author: By
Last change:
Date: 2 months ago
Size: 634 bytes
 

Contents

Class file image Download

Figure

> Figure class allows to create rectangles or ellipses.

The following example creates an rectangle, set an opacity (75%) and save it as PNG:

<?php

use GImage\Figure;

$rectangle = new Figure(400, 250);
$rectangle
    ->setBackgroundColor(0, 0, 255)
    ->setOpacity(0.75)
    ->create()
    ->save('/home/my_user/images/reactangle.png');

As above example, we can also create an ellipse:

<?php

use GImage\Figure;

$ellipse = new Figure(300, 300);
$ellipse
    ->isEllipse()
    ->setBackgroundColor(255, 0, 0)
    ->setOpacity(0.5)
    ->create()
    ->save('/home/my_user/images/ellipse.png');