PHP Class Neos\Media\Domain\Model\Adjustment\ResizeImageAdjustment

Inheritance: extends AbstractImageAdjustment
Show file Open project: neos/neos-development-collection

Protected Properties

Property Type Description
$allowUpScaling boolean
$height integer
$maximumHeight integer
$maximumWidth integer
$minimumHeight integer
$minimumWidth integer
$position integer
$ratioMode string One of the ImagineImageInterface::RATIOMODE_* constants
$width integer

Public Methods

Method Description
applyToImage ( Imagine\Image\ImageInterface $image ) : Imagine\Image\ImageInterface Applies this adjustment to the given Imagine Image object
canBeApplied ( Imagine\Image\ImageInterface $image ) : boolean Check if this Adjustment can or should be applied to its ImageVariant.
getAllowUpScaling ( ) : boolean Returns allowUpScaling
getHeight ( ) : integer Returns height
getMaximumHeight ( ) : integer Returns maximumHeight
getMaximumWidth ( ) : integer Returns maximumWidth
getMinimumHeight ( ) : integer Returns minimumHeight
getMinimumWidth ( ) : integer Returns minimumWidth
getRatioMode ( ) : string Returns ratioMode
getWidth ( ) : integer Returns width
setAllowUpScaling ( boolean $allowUpScaling ) : void Sets allowUpScaling
setHeight ( integer $height ) : void Sets height
setMaximumHeight ( integer $maximumHeight ) : void Sets maximumHeight
setMaximumWidth ( integer $maximumWidth ) : void Sets maximumWidth
setMinimumHeight ( integer $minimumHeight ) : void Sets minimumHeight
setMinimumWidth ( integer $minimumWidth ) : void Sets minimumWidth
setRatioMode ( string $ratioMode ) : void Sets ratioMode
setWidth ( integer $width ) : void Sets width

Protected Methods

Method Description
calculateDimensions ( Imagine\Image\BoxInterface $originalDimensions ) : Imagine\Image\BoxInterface Calculates and returns the dimensions the image should have according all parameters set in this adjustment.
calculateOutboundBox ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedWidth, integer $requestedHeight ) : Imagine\Image\BoxInterface 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.
calculateOutboundScalingDimensions ( Imagine\Image\BoxInterface $imageSize, Imagine\Image\BoxInterface $requestedDimensions ) : Imagine\Image\BoxInterface Calculates a resize dimension box that allows for outbound resize.
calculateScalingToHeight ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedHeight ) : Imagine\Image\BoxInterface Calculates new dimensions with a requested height applied. Takes upscaling into consideration.
calculateScalingToWidth ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedWidth ) : Imagine\Image\BoxInterface Calculates new dimensions with a requested width applied. Takes upscaling into consideration.
calculateWithFixedDimensions ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedWidth, integer $requestedHeight ) : Imagine\Image\BoxInterface
resize ( Imagine\Image\ImageInterface $image, string $mode = ImageInterface::RATIOMODE_INSET, string $filter = ImagineImageInterface::FILTER_UNDEFINED ) : Imagine\Image\ManipulatorInterface Executes the actual resizing operation on the Imagine image.

Method Details

applyToImage() public method

Applies this adjustment to the given Imagine Image object
public applyToImage ( Imagine\Image\ImageInterface $image ) : Imagine\Image\ImageInterface
$image Imagine\Image\ImageInterface
return Imagine\Image\ImageInterface

calculateDimensions() protected method

Calculates and returns the dimensions the image should have according all parameters set in this adjustment.
protected calculateDimensions ( Imagine\Image\BoxInterface $originalDimensions ) : Imagine\Image\BoxInterface
$originalDimensions Imagine\Image\BoxInterface Dimensions of the unadjusted image
return Imagine\Image\BoxInterface

calculateOutboundBox() protected method

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 calculateOutboundBox ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedWidth, integer $requestedHeight ) : Imagine\Image\BoxInterface
$originalDimensions Imagine\Image\BoxInterface
$requestedWidth integer
$requestedHeight integer
return Imagine\Image\BoxInterface

calculateOutboundScalingDimensions() protected method

The scaled image will be bigger than the requested dimensions in one dimension and then cropped.
protected calculateOutboundScalingDimensions ( Imagine\Image\BoxInterface $imageSize, Imagine\Image\BoxInterface $requestedDimensions ) : Imagine\Image\BoxInterface
$imageSize Imagine\Image\BoxInterface
$requestedDimensions Imagine\Image\BoxInterface
return Imagine\Image\BoxInterface

calculateScalingToHeight() protected method

Calculates new dimensions with a requested height applied. Takes upscaling into consideration.
protected calculateScalingToHeight ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedHeight ) : Imagine\Image\BoxInterface
$originalDimensions Imagine\Image\BoxInterface
$requestedHeight integer
return Imagine\Image\BoxInterface

calculateScalingToWidth() protected method

Calculates new dimensions with a requested width applied. Takes upscaling into consideration.
protected calculateScalingToWidth ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedWidth ) : Imagine\Image\BoxInterface
$originalDimensions Imagine\Image\BoxInterface
$requestedWidth integer
return Imagine\Image\BoxInterface

calculateWithFixedDimensions() protected method

protected calculateWithFixedDimensions ( Imagine\Image\BoxInterface $originalDimensions, integer $requestedWidth, integer $requestedHeight ) : Imagine\Image\BoxInterface
$originalDimensions Imagine\Image\BoxInterface
$requestedWidth integer
$requestedHeight integer
return Imagine\Image\BoxInterface

canBeApplied() public method

Check if this Adjustment can or should be applied to its ImageVariant.
public canBeApplied ( Imagine\Image\ImageInterface $image ) : boolean
$image Imagine\Image\ImageInterface
return boolean

getAllowUpScaling() public method

Returns allowUpScaling
public getAllowUpScaling ( ) : boolean
return boolean

getHeight() public method

Returns height
public getHeight ( ) : integer
return integer

getMaximumHeight() public method

Returns maximumHeight
public getMaximumHeight ( ) : integer
return integer

getMaximumWidth() public method

Returns maximumWidth
public getMaximumWidth ( ) : integer
return integer

getMinimumHeight() public method

Returns minimumHeight
public getMinimumHeight ( ) : integer
return integer

getMinimumWidth() public method

Returns minimumWidth
public getMinimumWidth ( ) : integer
return integer

getRatioMode() public method

Returns ratioMode
public getRatioMode ( ) : string
return string

getWidth() public method

Returns width
public getWidth ( ) : integer
return integer

resize() protected method

In case of an outbound resize the image will be resized and cropped.
protected resize ( Imagine\Image\ImageInterface $image, string $mode = ImageInterface::RATIOMODE_INSET, string $filter = ImagineImageInterface::FILTER_UNDEFINED ) : Imagine\Image\ManipulatorInterface
$image Imagine\Image\ImageInterface
$mode string
$filter string
return Imagine\Image\ManipulatorInterface

setAllowUpScaling() public method

Sets allowUpScaling
public setAllowUpScaling ( boolean $allowUpScaling ) : void
$allowUpScaling boolean
return void

setHeight() public method

Sets height
public setHeight ( integer $height ) : void
$height integer
return void

setMaximumHeight() public method

Sets maximumHeight
public setMaximumHeight ( integer $maximumHeight ) : void
$maximumHeight integer
return void

setMaximumWidth() public method

Sets maximumWidth
public setMaximumWidth ( integer $maximumWidth ) : void
$maximumWidth integer
return void

setMinimumHeight() public method

Sets minimumHeight
public setMinimumHeight ( integer $minimumHeight ) : void
$minimumHeight integer
return void

setMinimumWidth() public method

Sets minimumWidth
public setMinimumWidth ( integer $minimumWidth ) : void
$minimumWidth integer
return void

setRatioMode() public method

Sets ratioMode
public setRatioMode ( string $ratioMode ) : void
$ratioMode string One of the \Neos\Media\Domain\Model\ImageInterface::RATIOMODE_* constants
return void

setWidth() public method

Sets width
public setWidth ( integer $width ) : void
$width integer
return void

Property Details

$allowUpScaling protected property

protected bool $allowUpScaling
return boolean

$height protected property

protected int $height
return integer

$maximumHeight protected property

protected int $maximumHeight
return integer

$maximumWidth protected property

protected int $maximumWidth
return integer

$minimumHeight protected property

protected int $minimumHeight
return integer

$minimumWidth protected property

protected int $minimumWidth
return integer

$position protected property

protected int $position
return integer

$ratioMode protected property

One of the ImagineImageInterface::RATIOMODE_* constants
protected string $ratioMode
return string

$width protected property

protected int $width
return integer