PHP Class Imbo\EventListener\ImageTransformationCache

Event listener that stores transformed images to disk. By using this listener Imbo will only have to generate each transformation once. The listener is also responsible for deleting images from the cache when the original images are deleted through the API. The values used to generate the unique cache key for each image are: - user - image identifier - normalized accept header - image extension (can be null) - image transformations (can be null)
Author: Christer Edvartsen ([email protected])
Inheritance: implements Imbo\EventListener\ListenerInterface
Datei anzeigen Open project: imbo/imbo Class Usage Examples

Public Methods

Method Description
__construct ( array $params ) Class constructor
deleteFromCache ( Imbo\EventManager\EventInterface $event ) Delete cached images from the cache
getSubscribedEvents ( )
loadFromCache ( Imbo\EventManager\EventInterface $event ) Load transformed images from the cache
storeInCache ( Imbo\EventManager\EventInterface $event ) Store transformed images in the cache

Private Methods

Method Description
getCacheDir ( string $user, string $imageIdentifier ) : string Get the path to the current image cache dir
getCacheFilePath ( Request $request ) : string Get the absolute path to response in the cache
getCacheKey ( Request $request ) : string Generate a cache key
isWritable ( string $path ) : boolean Check whether or not a directory (or its parent) is writable
rmdir ( string $dir ) Completely remove a directory (with contents)

Method Details

__construct() public method

Class constructor
public __construct ( array $params )
$params array Parameters for the cache

deleteFromCache() public method

Delete cached images from the cache
public deleteFromCache ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event

getSubscribedEvents() public static method

public static getSubscribedEvents ( )

loadFromCache() public method

Load transformed images from the cache
public loadFromCache ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event

storeInCache() public method

Store transformed images in the cache
public storeInCache ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event