class ImageSizeConstrain implements PreProcessorInterface (View source)

Constants

PREPROCESSOR_PRIORITY

Properties

private int|null $maxWidth

Maximum image width (if set).

private int|null $maxHeight

Maximum image height (if set).

private int $constraintMode

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

Methods

$this
readConfiguration(Repository $config)

Initialize the processor from the configured values.

int|null
getMaxWidth()

Get the maximum image width (if set).

$this
setMaxWidth(int|float|null $value)

Set the maximum image width.

int|null
getMaxHeight()

Get the maximum image height (if set).

$this
setMaxHeight(int|float|null $value)

Set the maximum image height.

int
getConstraintMode()

Get the resize mode.

$this
setConstraintMode(int $value)

Set the resize mode.

int
getPreProcessPriority()

Get the priority of this pre-processor.

bool
shouldPreProcess(ImportingFile $file, ImportOptions $options)

Check if this pre-processor should process a file being imported.

preProcess(ImportingFile $file, ImportOptions $options)

Pre-process a file being imported.

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.

Details

$this readConfiguration(Repository $config)

Initialize the processor from the configured values.

Parameters

Repository $config

Return Value

$this

See also

ProcessorInterface::readConfiguration

int|null getMaxWidth()

Get the maximum image width (if set).

Return Value

int|null

$this setMaxWidth(int|float|null $value)

Set the maximum image width.

Parameters

int|float|null $value

Return Value

$this

int|null getMaxHeight()

Get the maximum image height (if set).

Return Value

int|null

$this setMaxHeight(int|float|null $value)

Set the maximum image height.

Parameters

int|float|null $value

Return Value

$this

int getConstraintMode()

Get the resize mode.

Return Value

int

One of the ImageInterface::THUMBNAIL_... constants

See also

ImageInterface

$this setConstraintMode(int $value)

Set the resize mode.

Parameters

int $value

One of the ImageInterface::THUMBNAIL_... constants

Return Value

$this

See also

ImageInterface

int getPreProcessPriority()

Get the priority of this pre-processor.

bool shouldPreProcess(ImportingFile $file, ImportOptions $options)

Check if this pre-processor should process a file being imported.

Parameters

ImportingFile $file

the file being imported

ImportOptions $options

options to b used when importing the file

Return Value

bool

See also

PreProcessorInterface::shouldPreProcess

preProcess(ImportingFile $file, ImportOptions $options)

Pre-process a file being imported.

Parameters

ImportingFile $file

the file being imported

ImportOptions $options

options to b used when importing the file

See also

PreProcessorInterface::preProcess

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

Exceptions

InvalidArgumentException