PHP Classes

File: docs/content/

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


Class file image Download

Getting started


!!! tip "Requirements"

GImage requires PHP [`7.4`][1] or a recent PHP version with the latest [GD Extension][2].

Make sure that [GD extension][2] is loaded on your system. You can verify it using the following command:

php -r "var_dump(extension_loaded('gd'));"
# bool(true)

Then install GImage via [Composer][3]:

composer require joseluisq/gimage

[1]: [2]: [3]:


Loading an external PNG image and saving it as JPG:


// PNG image (600x199)
$url = '';

$arch = new Image();
	// Load from URL
	// Scale to 50% (300x99)
	// Change the format to JPG
	// Saving in local path