You are viewing the documentation for an older version of this package. You can check the version you are using with the following command:
composer show spatie/image
##Background
The background
method sets the background for transparent images.
The color can be a color name (see all available color names) or hexadecimal RGB(A).
$image->background('darkgray');
##Border
The border
method adds border with a certain $width
, $color
and $borderType
to the Image
.
$image->border(15, '007698', Manipulations::BORDER_SHRINK);
##Border types
##Manipulations::BORDER_OVERLAY
By default the border will be added as an overlay to the image.
##Manipulations::BORDER_SHRINK
The BORDER_SHRINK
type shrinks the image to fit the border around. The canvas size stays the same.
##Manipulations::BORDER_EXPAND
The BORDER_EXPAND
type adds the border to the outside of the image and thus expands the canvas.
##Orientation
The orientation
method can be used to rotate the Image
90
, 180
or 270
degrees.
$image->orientation(Manipulations::ORIENTATION_180);
The accepted values are available as the following constants on the Manipulations
class:
-
Manipulations::ORIENTATION_AUTO
(default EXIF orientation)
-
Manipulations::ORIENTATION_90
-
Manipulations::ORIENTATION_180
-
Manipulations::ORIENTATION_270
Flip/mirror an image 'horizontally', 'vertically' or 'both'.
$image->flip(Manipulations::FLIP_HORIZONTALLY);
The accepted values are available as the following constants on the Manipulations
class:
-
Manipulations::FLIP_HORIZONTALLY
-
Manipulations::FLIP_VERTICALLY
-
Manipulations::FLIP_BOTH