File: docs/examples/

Recommend this page to a friend!
  Classes of Jose Luis Quintana  >  GImage  >  docs/examples/  >  Download  
File: docs/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: 2 years ago
Size: 1,080 bytes


Class file image Download

Composing with canvas

Canvas class is useful to 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.

For more information send a message to info at phpclasses dot org.