trait CropTrait

Trait CropTrait

Methods

crop(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null, int|float|X $x = null, int|float|Y $y = null)

Extracts a region of the given width and height out of the original image.

thumbnail(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null, int|float|X $x = null, int|float|Y $y = null)

The thumb cropping mode is specifically used for creating image thumbnails from either face or custom coordinates, and must always be accompanied by the gravity qualifier set to one of the face detection or custom values.

auto(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null)

Automatically determines the best crop based on the gravity and specified dimensions.

Details

static Crop crop(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null, int|float|X $x = null, int|float|Y $y = null)

Extracts a region of the given width and height out of the original image.

Parameters

Name Type Description
$width int|float|string|null The required width of a transformed asset.
$height int|float|null The required height of a transformed asset.
$gravity Gravity Which part of the original image to include.
$x int|float|X Horizontal position for custom-coordinates based cropping
$y int|float|Y Vertical position for custom-coordinates based cropping

Return Value

Crop

static Crop thumbnail(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null, int|float|X $x = null, int|float|Y $y = null)

The thumb cropping mode is specifically used for creating image thumbnails from either face or custom coordinates, and must always be accompanied by the gravity qualifier set to one of the face detection or custom values.

Parameters

Name Type Description
$width int|float|string|null The required width of a transformed asset.
$height int|float|null The required height of a transformed asset.
$gravity Gravity Which part of the original image to include.
$x int|float|X Horizontal position for custom-coordinates based cropping
$y int|float|Y Vertical position for custom-coordinates based cropping

Return Value

Crop

static Crop auto(int|float|string|null $width = null, int|float|null $height = null, Gravity $gravity = null)

Automatically determines the best crop based on the gravity and specified dimensions.

If the requested dimensions are smaller than the best crop, the result is downscaled. If the requested dimensions are larger than the original image, the result is upscaled. Use this mode in conjunction with the g (gravity) parameter.

Parameters

Name Type Description
$width int|float|string|null The required width of a transformed asset.
$height int|float|null The required height of a transformed asset.
$gravity Gravity Which part of the original image to include.

Return Value

Crop