AbstractParamsProcessor
abstract class AbstractParamsProcessor (View source)
Base class to implement image service parameter compatibility.
This class was introduced along with the TwicPics image service to implement a basic compatibility layer with Imgix-type parameters. There are a few instances in the Twill and Twill Image [1] source code where parameters were hardcoded, such as:
w
h
fm
q
fit=crop
This was adopted internally as the minimum set of parameters for which Twill image services need to provide compatibility.
Constants
COMPATIBLE_PARAMS |
|
Properties
protected | $params | ||
protected | $width | ||
protected | $height | ||
protected | $format | ||
protected | $quality | ||
protected | $fit |
Methods
Abstract method to be implemented in concrete params processor classes.
Receives the original params array and calls the appropriate handler method
for each param. Custom handlers can be defined by following this naming
convention: handleParamNAME
, where NAME is the name of the param.
The generic param handler. Known parameter values will be extracted into the corresponding properties as defined in COMPATIBLE_PARAMS. Unknown params will remain untouched.
Details
abstract array
finalizeParams()
Abstract method to be implemented in concrete params processor classes.
This method is called after all parameters have been processed and must return a finalized params array to generate the image URL.
array
process(array $params)
Receives the original params array and calls the appropriate handler method
for each param. Custom handlers can be defined by following this naming
convention: handleParamNAME
, where NAME is the name of the param.
protected void
handleParam(string $key, mixed $value)
The generic param handler. Known parameter values will be extracted into the corresponding properties as defined in COMPATIBLE_PARAMS. Unknown params will remain untouched.