make — Create a new image resource
Description
public static Intervention\Image\Image make(mixed $source)
Static universal factory method to create a new image instance from source, which can be a filepath, a GD image resource or a binary image data.
Parameters
source
Source to create an image from. The method responds to the following input types:
- string - Path of the image in filesystem.
- string - URL of an image (
allow_url_fopen
must be enabled). - string - Binary image data.
- resource - PHP resource of type
gd
.
Return Values
Instance of Intervention\Image\Image
Examples
// create a new image resource from file
$img = Image::make('public/foo.jpg');
// create a new image from gd resource
$resource = imagecreatefromjpeg('public/foo.jpg');
$img = Image::make($resource);
// create a new image resource from binary data
$data = file_get_contents('public/foo.jpg');
$img = Image::make($data);
// create a new image directly from an url
$img = Image::make('http://example.com/example.jpg');
See also
当前内容版权归 intervention 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 intervention .