ResizeImageAdjustment
class ResizeImageAdjustment extends AbstractImageAdjustment (View source)
An adjustment for resizing an image
Properties
protected int | $position | ||
protected ImageVariant | $imageVariant | from AbstractImageAdjustment | |
protected int | $width | ||
protected int | $height | ||
protected int | $maximumWidth | ||
protected int | $maximumHeight | ||
protected int | $minimumWidth | ||
protected int | $minimumHeight | ||
protected string | $ratioMode | One of the ImagineImageInterface::RATIOMODE_* constants |
|
protected bool | $allowUpScaling | ||
protected string | $filter |
Methods
Sets maximumHeight
Returns maximumHeight
Sets maximumWidth
Returns maximumWidth
Sets height
Returns height
Sets width
Returns width
Sets minimumHeight
Returns minimumHeight
Sets minimumWidth
Returns minimumWidth
Sets ratioMode
Returns ratioMode
Returns allowUpScaling
Sets allowUpScaling
Check if this Adjustment can or should be applied to its ImageVariant.
Applies this adjustment to the given Imagine Image object
Calculates and returns the dimensions the image should have according all parameters set in this adjustment.
No description
Calculate the final dimensions for an outbound box. usually exactly the requested width and height unless that would require upscaling and it is not allowed.
Calculates new dimensions with a requested width applied. Takes upscaling into consideration.
Calculates new dimensions with a requested height applied. Takes upscaling into consideration.
Executes the actual resizing operation on the Imagine image.
Calculates a resize dimension box that allows for outbound resize.
Details
__construct(array $options = [])
Constructs this adjustment
void
setImageVariant(ImageVariant $imageVariant)
Sets the image variant this adjustment belongs to
int
getPosition()
No description
setPosition(int $position)
No description
void
setMaximumHeight(int $maximumHeight = null)
Sets maximumHeight
int|null
getMaximumHeight()
Returns maximumHeight
void
setMaximumWidth(int $maximumWidth = null)
Sets maximumWidth
int|null
getMaximumWidth()
Returns maximumWidth
void
setHeight(int $height = null)
Sets height
int|null
getHeight()
Returns height
void
setWidth(int $width = null)
Sets width
int|null
getWidth()
Returns width
void
setMinimumHeight(int $minimumHeight = null)
Sets minimumHeight
int|null
getMinimumHeight()
Returns minimumHeight
void
setMinimumWidth(int $minimumWidth = null)
Sets minimumWidth
int|null
getMinimumWidth()
Returns minimumWidth
void
setRatioMode(string $ratioMode)
Sets ratioMode
string
getRatioMode()
Returns ratioMode
bool
getAllowUpScaling()
Returns allowUpScaling
void
setAllowUpScaling(bool $allowUpScaling)
Sets allowUpScaling
bool
canBeApplied(ImageInterface $image)
Check if this Adjustment can or should be applied to its ImageVariant.
ImageInterface
applyToImage(ImageInterface $image)
internal | Should never be used outside of the media package. Rely on the ImageService to apply your adjustments. |
Applies this adjustment to the given Imagine Image object
protected BoxInterface
calculateDimensions(BoxInterface $originalDimensions)
Calculates and returns the dimensions the image should have according all parameters set in this adjustment.
protected BoxInterface
calculateWithFixedDimensions(BoxInterface $originalDimensions, int $requestedWidth, int $requestedHeight)
No description
protected BoxInterface
calculateOutboundBox(BoxInterface $originalDimensions, int $requestedWidth, int $requestedHeight)
Calculate the final dimensions for an outbound box. usually exactly the requested width and height unless that would require upscaling and it is not allowed.
protected BoxInterface
calculateScalingToWidth(BoxInterface $originalDimensions, int $requestedWidth)
Calculates new dimensions with a requested width applied. Takes upscaling into consideration.
protected BoxInterface
calculateScalingToHeight(BoxInterface $originalDimensions, int $requestedHeight)
Calculates new dimensions with a requested height applied. Takes upscaling into consideration.
protected ManipulatorInterface
resize(ImageInterface $image, string $mode = ImageInterface::RATIOMODE_INSET, string $filter = ImagineImageInterface::FILTER_UNDEFINED)
Executes the actual resizing operation on the Imagine image.
In case of an outbound resize the image will be resized and cropped.
protected BoxInterface
calculateOutboundScalingDimensions(BoxInterface $imageSize, BoxInterface $requestedDimensions)
Calculates a resize dimension box that allows for outbound resize.
The scaled image will be bigger than the requested dimensions in one dimension and then cropped.