Transformation
in package
implements
FilterInterface, ManipulatorInterface
A transformation filter.
Table of Contents
Interfaces
- FilterInterface
- Interface for imagine filters.
- ManipulatorInterface
- The manipulator interface.
Properties
- $filters : mixed
- $imagine : ImageInterface|null
- An ImagineInterface instance.
- $sorted : mixed|null
Methods
- __construct() : mixed
- Class constructor.
- add() : $this
- Registers a given FilterInterface in an internal array of filters for later application to an instance of ImageInterface.
- apply() : ImageInterface
- Applies scheduled transformation to an ImageInterface instance.
- applyFilter() : ImageInterface
- Applies a given FilterInterface onto given ImageInterface and returns modified ImageInterface.
- 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.
- getFilters() : array<string|int, mixed>
- Returns a list of filters sorted by their priority. Filters with same priority will be returned in the order they were added.
- 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.
Properties
$filters
private
mixed
$filters
= array()
$imagine
An ImagineInterface instance.
private
ImageInterface|null
$imagine
$sorted
private
mixed|null
$sorted
Methods
__construct()
Class constructor.
public
__construct([ImageInterface|null $imagine = null ]) : mixed
Parameters
- $imagine : ImageInterface|null = null
-
An ImagineInterface instance
add()
Registers a given FilterInterface in an internal array of filters for later application to an instance of ImageInterface.
public
add(FilterInterface $filter[, int $priority = 0 ]) : $this
Parameters
- $filter : FilterInterface
- $priority : int = 0
Return values
$thisapply()
Applies scheduled transformation to an ImageInterface instance.
public
apply(ImageInterface $image) : ImageInterface
Parameters
- $image : ImageInterface
Tags
Return values
ImageInterface —returns the processed ImageInterface instance
applyFilter()
Applies a given FilterInterface onto given ImageInterface and returns modified ImageInterface.
public
applyFilter(ImageInterface $image, FilterInterface $filter) : ImageInterface
Parameters
- $image : ImageInterface
- $filter : FilterInterface
Tags
Return values
ImageInterfaceapplyMask()
Applies a given mask to current image's alpha channel.
public
applyMask(ImageInterface $mask) : $this
Parameters
- $mask : ImageInterface
Tags
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
Tags
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
$thisgetFilters()
Returns a list of filters sorted by their priority. Filters with same priority will be returned in the order they were added.
public
getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>paste()
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[, mixed $alpha = 100 ]) : $this
Parameters
- $image : ImageInterface
- $start : PointInterface
- $alpha : mixed = 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[, mixed $filter = ImageInterface::FILTER_UNDEFINED ]) : $this
Parameters
- $size : BoxInterface
- $filter : mixed = ImageInterface::FILTER_UNDEFINED
Tags
Return values
$thisrotate()
Rotates an image at the given angle.
public
rotate(mixed $angle[, ColorInterface $background = null ]) : $this
Parameters
- $angle : mixed
- $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([mixed $path = null ][, array<string|int, mixed> $options = array() ]) : $this
Parameters
- $path : mixed = null
- $options : array<string|int, mixed> = array()
Tags
Return values
$thisshow()
Outputs the image content.
public
show(mixed $format[, array<string|int, mixed> $options = array() ]) : $this
Parameters
- $format : mixed
- $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[, mixed $settings = ImageInterface::THUMBNAIL_INSET ][, mixed $filter = ImageInterface::FILTER_UNDEFINED ]) : static
Parameters
- $size : BoxInterface
- $settings : mixed = ImageInterface::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 : mixed = ImageInterface::FILTER_UNDEFINED
-
The filter to use for resizing, one of ImageInterface::FILTER_*