28 lines
768 B
PHP
28 lines
768 B
PHP
|
<?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;
|
||
|
}
|
||
|
}
|
||
|
}
|