Method | Description | |
---|---|---|
__construct ( array $sizes ) | Define the available sizes, for example: [ 'small' => 'resizeCrop,50,50', 'medium' => 'resize,500', 'big' => 'resize,1000', ]. | |
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface | Execute the middleware. | |
cache ( Psr\Cache\CacheItemPoolInterface $cache ) : self | To save the transformed images in the cache. | |
clientHints ( array $clientHints = ['Dpr', 'Viewport-Width', 'Width'] ) : self | Enable the client hints. | |
getGenerator ( Psr\Http\Message\ServerRequestInterface $request ) : callable | null | Returns a callable to generate urls. |
Method | Description | |
---|---|---|
getCacheKey ( Psr\Http\Message\ServerRequestInterface $request ) : string | Generates the key used to save the image in cache. | |
getClientHints ( Psr\Http\Message\ServerRequestInterface $request ) : array | null | Returns the client hints sent. | |
parsePath ( string $path ) : false | array | Parses the path and return the file and transform values. | |
transform ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, string $transform ) : Psr\Http\Message\ResponseInterface | Transform the image. |
public __construct ( array $sizes ) | ||
$sizes | array |
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface | ||
$request | Psr\Http\Message\ServerRequestInterface | |
$response | Psr\Http\Message\ResponseInterface | |
$next | callable | |
return | Psr\Http\Message\ResponseInterface |
public cache ( Psr\Cache\CacheItemPoolInterface $cache ) : self | ||
$cache | Psr\Cache\CacheItemPoolInterface | |
return | self |
public clientHints ( array $clientHints = ['Dpr', 'Viewport-Width', 'Width'] ) : self | ||
$clientHints | array | |
return | self |
public static getGenerator ( Psr\Http\Message\ServerRequestInterface $request ) : callable | null | ||
$request | Psr\Http\Message\ServerRequestInterface | |
return | callable | null |