Download the PHP package acoustep/canvas without Composer
On this page you can find all versions of the php package acoustep/canvas. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download acoustep/canvas
More information about acoustep/canvas
Files in acoustep/canvas
Package canvas
Short Description Simple GD Library class for resizing images
License MIT
Homepage http://github.com/acoustep/canvas
Informations about the package canvas
Canvas
Canvas is a simple PHP class for creating and manipulating image sizes with the GD Library.
Usage
Setting up the canvas
There are two ways to set up the canvas.
-
Through the constructor
- Through methods
Adding images
Images are added through the image method, you can add as many layers as you would like.
The first image added will be added to the bottom of the output. The rest will be layered on top of each other in the order they were added.
The image method takes two arguments: A string (The file along with the path to the file) and an array of arguments.
X can be an integer which is the offset from the canvas in pixels or left, centre or right.
Y can also be an integer for a specific offset, top, middle or bottom
Scale can be width, height, best or false.
- Width sets the image to fit best with the canvas width.
- Height sets the image to fit best with the canvas height.
- Best will try to figure out whether to use width or height for you.
- False will keep the image size the same as it was originally.
Outputting the image
There are three methods to output the image to the user. , and .
- Filetype lets you set the image type. PNG, GIF and JPG are supported.
- Output lets you specify a filename to output the image to. If it will try to output to the current file - You will need to set the headers appropriately for it.
- Create is used when you are ready to output the image to the user. This method is always called last.