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
private Repository $config

Methods

setApplication(Application $app)

Setter method for the application

__construct(Repository $config)

No description

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

__construct(Repository $config)

Parameters

Repository $config

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)

Parameters

File $file
array $thumbnail

Return Value

bool

private null|StorageLocationInterface storageLocation()

Return Value

null|StorageLocationInterface

protected BasicThumbnailer getThumbnailer()

Return Value

BasicThumbnailer

protected EntityManagerInterface getEntityManager()

Return Value

EntityManagerInterface

protected Connection getConnection()

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