PHP Class Imbo\EventListener\ImageVariations

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

Méthodes publiques

Méthode 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

Méthode Description
configureDatabase ( array $config ) Configure the database adapter
configureStorage ( array $config ) Configure the storage adapter

Method Details

__construct() public méthode

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

adjustImageTransformations() public méthode

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 méthode

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 méthode

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 méthode

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

getMaxWidth() public méthode

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
Résultat 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 méthode

public static getSubscribedEvents ( )