__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:
- string - Path of the image in filesystem.
- string - Binary image data.
- resource - PHP resource of type
gd
.
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
当前内容版权归 intervention 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 intervention .