ManipulatorInterface
in
The manipulator interface.
Table of Contents
Constants
- THUMBNAIL_FLAG_NOCLONE = 0x20000
- Instead of creating a new image instance, the thumbnail method modifies the original image (saving memory.
- THUMBNAIL_FLAG_UPSCALE = 0x10000
- Allow upscaling the image if it's smaller than the wanted thumbnail size.
- THUMBNAIL_INSET = 0x1
- The original image is scaled so it is fully contained within the thumbnail dimensions (the image width/height ratio doesn't change).
- THUMBNAIL_OUTBOUND = 0x2
- The thumbnail is scaled so that its smallest side equals the length of the corresponding side in the original image (the width or the height are cropped).
Methods
- applyMask() : $this
- Applies a given mask to current image's alpha channel.
- copy() : static
- Copies current source image into a new ImageInterface instance.
- crop() : $this
- Crops a specified box out of the source image (modifies the source image) Returns cropped self.
- fill() : $this
- Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image.
- flipHorizontally() : $this
- Flips current image using vertical axis.
- flipVertically() : $this
- Flips current image using horizontal axis.
- paste() : $this
- Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails.
- resize() : $this
- Resizes current image and returns self.
- rotate() : $this
- Rotates an image at the given angle.
- save() : $this
- Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp, xbm, webp and bmp are supported.
- show() : $this
- Outputs the image content.
- strip() : $this
- Remove all profiles and comments.
- thumbnail() : static
- Generates a thumbnail from a current image Returns it as a new image without modifying the current image unless the THUMBNAIL_FLAG_NOCLONE flag is specified.
Constants
THUMBNAIL_FLAG_NOCLONE
Instead of creating a new image instance, the thumbnail method modifies the original image (saving memory.
public
int
THUMBNAIL_FLAG_NOCLONE
= 0x20000
THUMBNAIL_FLAG_UPSCALE
Allow upscaling the image if it's smaller than the wanted thumbnail size.
public
int
THUMBNAIL_FLAG_UPSCALE
= 0x10000
THUMBNAIL_INSET
The original image is scaled so it is fully contained within the thumbnail dimensions (the image width/height ratio doesn't change).
public
int
THUMBNAIL_INSET
= 0x1
THUMBNAIL_OUTBOUND
The thumbnail is scaled so that its smallest side equals the length of the corresponding side in the original image (the width or the height are cropped).
public
int
THUMBNAIL_OUTBOUND
= 0x2
Methods
applyMask()
Applies a given mask to current image's alpha channel.
public
applyMask(ImageInterface $mask) : $this
Parameters
- $mask : ImageInterface
Return values
$thiscopy()
Copies current source image into a new ImageInterface instance.
public
copy() : static
Tags
Return values
staticcrop()
Crops a specified box out of the source image (modifies the source image) Returns cropped self.
public
crop(PointInterface $start, BoxInterface $size) : $this
Parameters
- $start : PointInterface
- $size : BoxInterface
Tags
Return values
$thisfill()
Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image.
public
fill(FillInterface $fill) : $this
Parameters
- $fill : FillInterface
Return values
$thisflipHorizontally()
Flips current image using vertical axis.
public
flipHorizontally() : $this
Tags
Return values
$thisflipVertically()
Flips current image using horizontal axis.
public
flipVertically() : $this
Tags
Return values
$thispaste()
Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails.
public
paste(ImageInterface $image, PointInterface $start[, int $alpha = 100 ]) : $this
Returns source image
Parameters
- $image : ImageInterface
- $start : PointInterface
- $alpha : int = 100
-
How to paste the image, from 0 (fully transparent) to 100 (fully opaque)
Tags
Return values
$thisresize()
Resizes current image and returns self.
public
resize(BoxInterface $size[, string $filter = ImageInterface::FILTER_UNDEFINED ]) : $this
Parameters
- $size : BoxInterface
- $filter : string = ImageInterface::FILTER_UNDEFINED
Tags
Return values
$thisrotate()
Rotates an image at the given angle.
public
rotate(int $angle[, ColorInterface $background = null ]) : $this
Optional $background can be used to specify the fill color of the empty area of rotated image.
Parameters
- $angle : int
- $background : ColorInterface = null
Tags
Return values
$thissave()
Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp, xbm, webp and bmp are supported.
public
save([string $path = null ][, array<string|int, mixed> $options = array() ]) : $this
Please remark that bmp is supported by the GD driver only since PHP 7.2.
Parameters
- $path : string = null
- $options : array<string|int, mixed> = array()
Tags
Return values
$thisshow()
Outputs the image content.
public
show(string $format[, array<string|int, mixed> $options = array() ]) : $this
Parameters
- $format : string
- $options : array<string|int, mixed> = array()
Tags
Return values
$thisstrip()
Remove all profiles and comments.
public
strip() : $this
Tags
Return values
$thisthumbnail()
Generates a thumbnail from a current image Returns it as a new image without modifying the current image unless the THUMBNAIL_FLAG_NOCLONE flag is specified.
public
thumbnail(BoxInterface $size[, int|string $settings = self::THUMBNAIL_INSET ][, string $filter = ImageInterface::FILTER_UNDEFINED ]) : static
Parameters
- $size : BoxInterface
- $settings : int|string = self::THUMBNAIL_INSET
-
One or more of the ManipulatorInterface::THUMBNAIL_ flags (joined with |). It may be a string for backward compatibility with old constant values that were strings.
- $filter : string = ImageInterface::FILTER_UNDEFINED
-
The filter to use for resizing, one of ImageInterface::FILTER_*