class ConstrainImageProcessor implements ProcessorInterface (View source)

Properties

protected Application $app
protected int|null $maxWidth

Maximum image width (if set).

protected int|null $maxHeight

Maximum image height (if set).

protected string $constraintMode

Resize mode (one of the ImageInterface::THUMBNAIL_... constants).

protected bool $rescanThumbnails

Should thumbnails be rescanned when the image is resized?

Methods

__construct(int|null $maxWidth = null, int|null $maxHeight = null, string|null $constraintMode = null)

Initialize the instance.

int|null
getMaxWidth()

Get the maximum image width (if set).

setMaxWidth(int|null $maxWidth)

Set the maximum image width (if set).

int|null
getMaxHeight()

Get the maximum image height (if set).

setMaxHeight(int|null $maxHeight)

Set the maximum image height (if set).

string
getConstraintMode()

Get the resize mode.

setConstraintMode(string $constraintMode)

Set the resize mode.

bool
isRescanThumbnails()

Should thumbnails be rescanned when the image is resized?

$this
setRescanThumbnails(bool $rescanThumbnails)

Should thumbnails be rescanned when the image is resized?

shouldProcess(Version $version)

No description

ImageInterface
resizeInPlace(ImageInterface $image, Box $size, string $mode = ImageInterface::THUMBNAIL_INSET, string $filter = ImageInterface::FILTER_UNDEFINED)

This function is a copy of the core thumbnail() function, modified to allow thumbnailing without making a copy in memory first as it is not always needed depending on the context.

process(Version $version)

No description

bool
getResizeInPlace() deprecated

No description

setResizeInPlace(bool $resizeInPlace) deprecated

No description

Details

__construct(int|null $maxWidth = null, int|null $maxHeight = null, string|null $constraintMode = null)

Initialize the instance.

Parameters

int|null $maxWidth

the maximum image width (if set)

int|null $maxHeight

the maximum image height (if set)

string|null $constraintMode

The resize mode (one of the ImageInterface::THUMBNAIL_... constants)

int|null getMaxWidth()

Get the maximum image width (if set).

Return Value

int|null

setMaxWidth(int|null $maxWidth)

Set the maximum image width (if set).

Parameters

int|null $maxWidth

int|null getMaxHeight()

Get the maximum image height (if set).

Return Value

int|null

setMaxHeight(int|null $maxHeight)

Set the maximum image height (if set).

Parameters

int|null $maxHeight

string getConstraintMode()

Get the resize mode.

Return Value

string

One of the ImageInterface::THUMBNAIL_... constants

setConstraintMode(string $constraintMode)

Set the resize mode.

Parameters

string $constraintMode

One of the ImageInterface::THUMBNAIL_... constants

bool isRescanThumbnails()

Should thumbnails be rescanned when the image is resized?

Return Value

bool

$this setRescanThumbnails(bool $rescanThumbnails)

Should thumbnails be rescanned when the image is resized?

Parameters

bool $rescanThumbnails

Return Value

$this

shouldProcess(Version $version)

No description

Parameters

Version $version

See also

ProcessorInterface::shouldProcess

ImageInterface resizeInPlace(ImageInterface $image, Box $size, string $mode = ImageInterface::THUMBNAIL_INSET, string $filter = ImageInterface::FILTER_UNDEFINED)

This function is a copy of the core thumbnail() function, modified to allow thumbnailing without making a copy in memory first as it is not always needed depending on the context.

Parameters

ImageInterface $image

The image to be resized

Box $size

The size of the image

string $mode
string $filter

Return Value

ImageInterface

Exceptions

InvalidArgumentException

process(Version $version)

No description

Parameters

Version $version

bool getResizeInPlace() deprecated

deprecated It's always true

No description

Return Value

bool

setResizeInPlace(bool $resizeInPlace) deprecated

deprecated It's always true

No description

Parameters

bool $resizeInPlace