PadTrait
trait PadTrait
Trait PadTrait
Methods
Sets the compass direction.
Sets the x offset.
Sets the y offset.
Sets the x and y offset.
Resizes the image to fill the given width and height while retaining the original aspect ratio and with all of the original image visible.
Same as the Pad::pad mode but only if the original image is larger than the given limit (width and height), in which case the image is scaled down to fill the given width and height while retaining the original aspect ratio and with all of the original image visible.
Same as the Pad::pad mode but only if the original image is smaller than the given minimum (width and height), in which case the image is scaled up to fill the given width and height while retaining the original aspect ratio and with all of the original image visible.
Sets pad position.
Details
CompassGravityTrait
gravity(string $compassGravity)
Sets the compass direction.
The compass direction represents a location in the image, for example, Gravity::northEast() represents the top right corner.
$this
offsetX(int|float|string $x)
Sets the x offset.
$this
offsetY(int|float|string $y)
Sets the y offset.
OffsetTrait
offset(int|float|string $x = null, int|float|string $y = null)
Sets the x and y offset.
$this
background(Background|ColorValue|string $background)
Sets the background.
The image background is visible when padding is added with one of the padding crop modes, when rounding corners, when adding overlays, and with semi-transparent PNGs and GIFs.
static Pad
pad(int|float|string|null $width = null, int|float|null $height = null, string|ColorValue $background = null)
Resizes the image to fill the given width and height while retaining the original aspect ratio and with all of the original image visible.
If the proportions of the original image do not match the given width and height, padding is added to the image to reach the required size
static Pad
limitPad(int|float|string|null $width = null, int|float|null $height = null, string|ColorValue $background = null)
Same as the Pad::pad mode but only if the original image is larger than the given limit (width and height), in which case the image is scaled down to fill the given width and height while retaining the original aspect ratio and with all of the original image visible.
This mode doesn't scale up the image if your requested dimensions are bigger than the original image's.
static Pad
minimumPad(int|float|string|null $width = null, int|float|null $height = null, string|ColorValue $background = null)
Same as the Pad::pad mode but only if the original image is smaller than the given minimum (width and height), in which case the image is scaled up to fill the given width and height while retaining the original aspect ratio and with all of the original image visible.
This mode doesn't scale down the image if your requested dimensions are smaller than the original image's.
$this
position(BasePosition $position)
Sets pad position.