ScaleTrait
trait ScaleTrait
Trait ScaleTrait
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.
Details
static Scale
scale(int|float|string|null $width = null, int|float|null $height = null, int|float|array $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(int|float|string|null $width = null, int|float|null $height = null, int|float|array $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(int|float|string $width = null, int|float $height = null, int|float|array $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(int|float|string|null $width = null, int|float|null $height = null, int|float|array $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.