class ThumbnailMiddleware implements MiddlewareInterface, ApplicationAwareInterface (View source)

Class ThumbnailMiddleware Middleware used to populate thumbnails at the end of each request.

This middleware requires the following to be defined on the Application: "database" DatabaseManager "BasicThumbnailer::class" Basic thumbnailer

Traits

Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface

Properties

protected Application $app from  ApplicationAwareTrait
protected Filesystem $baseFileSystem
private BasicThumbnailer $thumbnailer
private EntityManagerInterface $entityManager
private Connection $connection

Methods

setApplication(Application $app)

Setter method for the application

Response
process(Request $request, DelegateInterface $frame)

Process the request and return a response.

generateThumbnails(array[] $paths, Connection $database)

Generate thumbnails and and manage db update.

bool
attemptBuild(File $file, array $thumbnail)

Try building an unbuilt thumbnail.

array
getDimensions(array $thumbnail)

Get the dimensions out of a thumbnail array.

bool
isBuilt(File $file, array $thumbnail)

No description

getThumbnailer()

No description

EntityManagerInterface
getEntityManager()

No description

getConnection()

No description

completeBuild(File $file, $thumbnail)

Mark the build complete.

failBuild(File $file, $thumbnail)

Mark the build failed.

Details

setApplication(Application $app)

Setter method for the application

Parameters

Application $app

Response process(Request $request, DelegateInterface $frame)

Process the request and return a response.

Parameters

Request $request
DelegateInterface $frame

Return Value

Response

private generateThumbnails(array[] $paths, Connection $database)

Generate thumbnails and and manage db update.

Parameters

array[] $paths
Connection $database

private bool attemptBuild(File $file, array $thumbnail)

Try building an unbuilt thumbnail.

Parameters

File $file
array $thumbnail

Return Value

bool

private array getDimensions(array $thumbnail)

Get the dimensions out of a thumbnail array.

Parameters

array $thumbnail

Return Value

array

[ width, height, crop ]

private bool isBuilt(File $file, array $thumbnail)

No description

Parameters

File $file
array $thumbnail

Return Value

bool

private null|StorageLocationInterface storageLocation()

No description

Return Value

null|StorageLocationInterface

protected BasicThumbnailer getThumbnailer()

No description

Return Value

BasicThumbnailer

protected EntityManagerInterface getEntityManager()

No description

Return Value

EntityManagerInterface

protected Connection getConnection()

No description

Return Value

Connection

private completeBuild(File $file, $thumbnail)

Mark the build complete.

Parameters

File $file
$thumbnail

private failBuild(File $file, $thumbnail)

Mark the build failed.

Parameters

File $file
$thumbnail