Resize
class Resize extends BaseResizeAction
Determines how to crop, scale, and/or zoom the delivered asset according to the requested dimensions.
Learn more: Resizing images | Resizing videos
Methods
Change the size of the image exactly to the given width and height without necessarily retaining the original aspect ratio: all original image parts are visible but might be stretched or shrunk.
The image is resized so that it takes up as much space as possible within a bounding box defined by the given width and height qualifiers. The original aspect ratio is retained and all of the original image is visible.
Same as the Scale::fit mode but only if the original image is larger than the given limit (width and height), in which case the image is scaled down so that it takes up as much space as possible within a bounding box defined by the given width and height qualifiers. The original aspect ratio is retained and all of the original image is visible.
Same as the Scale::fit mode but only if the original image is smaller than the given minimum (width and height), in which case the image is scaled up so that it takes up as much space as possible within a bounding box defined by the given width and height qualifiers. The original aspect ratio is retained and all of the original image is visible.
Extracts a region of the given width and height out of the original image.
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.
Automatically determines the best crop based on the gravity and specified dimensions.
Details
static Scale
scale(mixed $width = null, mixed $height = null, mixed $aspectRatio = null)
Change the size of the image exactly to the given width and height without necessarily retaining the original aspect ratio: all original image parts are visible but might be stretched or shrunk.
static Scale
fit(mixed $width = null, mixed $height = null, mixed $aspectRatio = null)
The image is resized so that it takes up as much space as possible within a bounding box defined by the given width and height qualifiers. The original aspect ratio is retained and all of the original image is visible.
static Scale
limitFit(mixed $width = null, mixed $height = null, mixed $aspectRatio = null)
Same as the Scale::fit mode but only if the original image is larger than the given limit (width and height), in which case the image is scaled down so that it takes up as much space as possible within a bounding box defined by the given width and height qualifiers. The original aspect ratio is retained and all of the original image is visible.
static Scale
minimumFit(mixed $width = null, mixed $height = null, mixed $aspectRatio = null)
Same as the Scale::fit mode but only if the original image is smaller than the given minimum (width and height), in which case the image is scaled up so that it takes up as much space as possible within a bounding box defined by the given width and height qualifiers. The original aspect ratio is retained and all of the original image is visible.
static Crop
crop(mixed $width = null, mixed $height = null, mixed $gravity = null, mixed $x = null, mixed $y = null)
Extracts a region of the given width and height out of the original image.
static Crop
thumbnail(mixed $width = null, mixed $height = null, mixed $gravity = null, mixed $x = null, mixed $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.
static Crop
auto(mixed $width = null, mixed $height = null, AutoGravity|null $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.