PHP Classes

File: docs/content/examples/

Recommend this page to a friend!
  Classes of Jose Luis Quintana   GImage PHP Canvas to Image   docs/content/examples/   Download  
File: docs/content/examples/
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: 8 months ago
Size: 630 bytes


Class file image Download

Render images in-memory

The following example renders an image in-memory and return the string resource.


use GImage\Image;

$img = new Image();
$arch_url = '';

$resource = $img->load($arch_url)
    // Scale 120%
    // Rotate an image to -90
    // Change to PNG
    // Add opacity 70%
    // Render the image in-memory

// Output the resource (example only)
header('Content-Type: image/png');
// Necessary for opacity to work
imagesavealpha($resource, true);
imagepng($resource, null);