PHP Class Imbo\EventListener\ImageVariations

Author: Christer Edvartsen ([email protected])
Inheritance: implements Imbo\EventListener\ListenerInterface
Show file Open project: imbo/imbo Class Usage Examples

Public Methods

Method Description
__construct ( array $params = [] ) Class constructor
adjustImageTransformations ( Imbo\EventManager\EventInterface $event ) Adjust image transformations
chooseVariation ( Imbo\EventManager\EventInterface $event ) Choose an image variation based on the transformations and the original size of the image
deleteVariations ( Imbo\EventManager\EventInterface $event ) Delete all image variations attached to an image
generateVariations ( Imbo\EventManager\EventInterface $event ) Generate multiple variations based on the configuration
getMaxWidth ( integer $width, integer $height, array $transformations ) : array | null Fetch the maximum width present in the set of transformations
getSubscribedEvents ( )

Private Methods

Method Description
configureDatabase ( array $config ) Configure the database adapter
configureStorage ( array $config ) Configure the storage adapter

Method Details

__construct() public method

Class constructor
public __construct ( array $params = [] )
$params array Parameters for the event listener

adjustImageTransformations() public method

This method will adjust transformation parameters based on the ration between the original image and the image variation used.
public adjustImageTransformations ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event

chooseVariation() public method

Choose an image variation based on the transformations and the original size of the image
public chooseVariation ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event

deleteVariations() public method

If any of the delete operations fail Imbo will trigger an error
public deleteVariations ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event

generateVariations() public method

If any of the operations fail Imbo will trigger errors
public generateVariations ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface

getMaxWidth() public method

Fetch the maximum width present in the set of transformations
public getMaxWidth ( integer $width, integer $height, array $transformations ) : array | null
$width integer The width of the existing image
$height integer The height of the existing image
$transformations array Transformations from the URL
return array | null Returns an array with a single element where the index is the index of the transformation that has the maximum width, and the value of the width

getSubscribedEvents() public static method

public static getSubscribedEvents ( )