Fork me on GitHub

__construct — Create new instances

Description

public Intervention\Image\Image __construct([mixed $source, [int $width, [int $height, [mixed $bgcolor]]]])

Returns new Intervention Image object.

Parameters

source

Source to create an image from. Can be one of the following input types:

width

Width of the canvas when created without the path parameter.

height

Height of the canvas when created without the path parameter.

bgcolor

Background color of the canvas when created without the path parameter. See what color formats are supported.

Return Values

Instance of Intervention\Image\Image

Examples

// create an empty object
$img = new Image;

// create an object from image file
$img = new Image('public/foo.jpg');

// create an empty image object with transparent background
$img = new Image(null, 800, 600);

// create an empty image object with red background
$img = new Image(null, 800, 600, '#ff0000');

See also