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

__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)

Applies this adjustment to the given Imagine Image object

BoxInterface
calculateDimensions(BoxInterface $originalDimensions)

Calculates and returns the dimensions the image should have according all parameters set in this adjustment.

BoxInterface
calculateWithFixedDimensions(BoxInterface $originalDimensions, int $requestedWidth, int $requestedHeight)

No description

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.

BoxInterface
calculateScalingToWidth(BoxInterface $originalDimensions, int $requestedWidth)

Calculates new dimensions with a requested width applied. Takes upscaling into consideration.

BoxInterface
calculateScalingToHeight(BoxInterface $originalDimensions, int $requestedHeight)

Calculates new dimensions with a requested height applied. Takes upscaling into consideration.

ManipulatorInterface
resize(ImageInterface $image, string $mode = ImageInterface::RATIOMODE_INSET, string $filter = ImagineImageInterface::FILTER_UNDEFINED)

Executes the actual resizing operation on the Imagine image.

BoxInterface
calculateOutboundScalingDimensions(BoxInterface $imageSize, BoxInterface $requestedDimensions)

Calculates a resize dimension box that allows for outbound resize.

Details

__construct(array $options = [])

Constructs this adjustment

Parameters

array $options

configuration options - depends on the actual adjustment

Exceptions

InvalidArgumentException

void setImageVariant(ImageVariant $imageVariant)

Sets the image variant this adjustment belongs to

Parameters

ImageVariant $imageVariant

Return Value

void

int getPosition()

No description

Return Value

int

setPosition(int $position)

No description

Parameters

int $position

void setMaximumHeight(int $maximumHeight = null)

Sets maximumHeight

Parameters

int $maximumHeight

Return Value

void

int|null getMaximumHeight()

Returns maximumHeight

Return Value

int|null

void setMaximumWidth(int $maximumWidth = null)

Sets maximumWidth

Parameters

int $maximumWidth

Return Value

void

int|null getMaximumWidth()

Returns maximumWidth

Return Value

int|null

void setHeight(int $height = null)

Sets height

Parameters

int $height

Return Value

void

int|null getHeight()

Returns height

Return Value

int|null

void setWidth(int $width = null)

Sets width

Parameters

int $width

Return Value

void

int|null getWidth()

Returns width

Return Value

int|null

void setMinimumHeight(int $minimumHeight = null)

Sets minimumHeight

Parameters

int $minimumHeight

Return Value

void

int|null getMinimumHeight()

Returns minimumHeight

Return Value

int|null

void setMinimumWidth(int $minimumWidth = null)

Sets minimumWidth

Parameters

int $minimumWidth

Return Value

void

int|null getMinimumWidth()

Returns minimumWidth

Return Value

int|null

void setRatioMode(string $ratioMode)

Sets ratioMode

Parameters

string $ratioMode

One of the \Neos\Media\Domain\Model\ImageInterface::RATIOMODE_* constants

Return Value

void

string getRatioMode()

Returns ratioMode

Return Value

string

bool getAllowUpScaling()

Returns allowUpScaling

Return Value

bool

void setAllowUpScaling(bool $allowUpScaling)

Sets allowUpScaling

Parameters

bool $allowUpScaling

Return Value

void

bool canBeApplied(ImageInterface $image)

Check if this Adjustment can or should be applied to its ImageVariant.

Parameters

ImageInterface $image

Return Value

bool

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

Parameters

ImageInterface $image

Return Value

ImageInterface

protected BoxInterface calculateDimensions(BoxInterface $originalDimensions)

Calculates and returns the dimensions the image should have according all parameters set in this adjustment.

Parameters

BoxInterface $originalDimensions

Dimensions of the unadjusted image

Return Value

BoxInterface

protected BoxInterface calculateWithFixedDimensions(BoxInterface $originalDimensions, int $requestedWidth, int $requestedHeight)

No description

Parameters

BoxInterface $originalDimensions
int $requestedWidth
int $requestedHeight

Return Value

BoxInterface

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.

Parameters

BoxInterface $originalDimensions
int $requestedWidth
int $requestedHeight

Return Value

BoxInterface

protected BoxInterface calculateScalingToWidth(BoxInterface $originalDimensions, int $requestedWidth)

Calculates new dimensions with a requested width applied. Takes upscaling into consideration.

Parameters

BoxInterface $originalDimensions
int $requestedWidth

Return Value

BoxInterface

protected BoxInterface calculateScalingToHeight(BoxInterface $originalDimensions, int $requestedHeight)

Calculates new dimensions with a requested height applied. Takes upscaling into consideration.

Parameters

BoxInterface $originalDimensions
int $requestedHeight

Return Value

BoxInterface

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.

Parameters

ImageInterface $image
string $mode
string $filter

Return Value

ManipulatorInterface

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.

Parameters

BoxInterface $imageSize
BoxInterface $requestedDimensions

Return Value

BoxInterface