Definition at line 11 of file Thumbnail.php.
Paperyard\Controllers\Misc\Thumbnail::__construct |
( |
LoggerInterface |
$logger | ) |
|
Paperyard\Controllers\Misc\Thumbnail::__invoke |
( |
Request |
$request, |
|
|
Response |
$response, |
|
|
|
$args |
|
) |
| |
Definition at line 21 of file Thumbnail.php.
23 $path = base64_decode($request->getAttribute(
'path'));
24 $page = (int)$request->getAttribute(
'page');
25 $resolution = (int)$request->getAttribute(
'resolution');
28 if ($resolution == 0) {
33 $document_hash = (
new Document($path))->hash;
34 $thumbnail_path =
'static/img/cache/' . $document_hash .
'[' . $page .
'][' . $resolution .
'].jpg';
37 if (file_exists($thumbnail_path)) {
38 $cached_thumbnail_response = $response->withHeader(
'Content-type',
'image/jpeg');
39 readfile($thumbnail_path);
40 return $cached_thumbnail_response;
45 $im->setResolution($resolution, $resolution);
46 $im->readImage($path .
'[' . $page .
']');
47 $im->setImageFormat(
'jpg');
48 $im->writeImage($thumbnail_path);
51 $thumbnail_response = $response->withHeader(
'Content-type',
'image/jpeg');
57 return $thumbnail_response;
Paperyard\Controllers\Misc\Thumbnail::$logger |
|
protected |
The documentation for this class was generated from the following file: