Backport asynchronous thumbnail generation from Kabuki.

This commit is contained in:
2017-12-20 14:51:23 +01:00
parent 981b652e25
commit 1def1484cb
9 changed files with 566 additions and 214 deletions

View File

@@ -0,0 +1,27 @@
<?php
/*****************************************************************************
* GenerateThumbnail.php
* Contains the asynchronous thumbnail generation controller
*
* Kabuki CMS (C) 2013-2017, Aaron van Geffen
*****************************************************************************/
class GenerateThumbnail extends HTMLController
{
public function __construct()
{
$asset = Asset::fromId($_GET['id']);
if (empty($asset) || !$asset->isImage())
throw new NotFoundException('Image not found');
$image = $asset->getImage();
$crop_mode = isset($_GET['mode']) ? $_GET['mode'] : false;
$url = $image->getThumbnailUrl($_GET['width'], $_GET['height'], $crop_mode, true, true);
if ($url)
{
header('Location: ' . $url);
exit;
}
}
}