PHP Classes

File: docs/content/examples/

Recommend this page to a friend!
  Classes of Jose Luis Quintana   GImage   docs/content/examples/   Download  
File: docs/content/examples/
Role: Example script
Content type: text/markdown
Description: Example script
Class: GImage
Create graphic images with a fluent interface
Author: By
Last change:
Date: 8 months ago
Size: 1,081 bytes


Class file image Download

Composing with canvas

Canvas class is useful for composing several elements like images, text and figures.

!!! tip "Tip"

Canvas `append(arr)` function also supports an array of elements.


use GImage\Text;
use GImage\Image;
use GImage\Figure;
use GImage\Canvas;

$img1 = new Image();

$figure1 = new Figure(300, 150);
    ->setBackgroundColor(10, 20, 30)

$text1 = new Text('My awesome text!');
    ->setColor(255, 255, 255)

// used as canvas layout
$figure0 = new Figure(400, 250);
    ->setBackgroundColor(50, 20, 30)

$canvas = new Canvas($figure0);
    // append every element
    // as PNG format
    // draw the canvas with all elements

For more details check out the presentation card example.