forked from unacms/una
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage_transcoder.php
59 lines (45 loc) · 1.27 KB
/
image_transcoder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
* CC-BY License - http://creativecommons.org/licenses/by/3.0/
*
* @defgroup TridentCore Trident Core
* @{
*/
if (isset($_GET['devicePixelRatio'])) {
$sDpr = $_GET['devicePixelRatio'];
if ('' . ceil(intval($sDpr)) !== $sDpr)
$sDpr = '1';
setcookie('devicePixelRatio', $sDpr, time()+60*60*24*365);
exit();
}
ob_start();
require_once('./inc/header.inc.php');
$sTranscoderObject = bx_process_input(bx_get('o'));
$sHandler = bx_process_input(bx_get('h'));
$oTranscoder = BxDolTranscoderImage::getObjectInstance($sTranscoderObject);
if (!$oTranscoder) {
ob_end_clean();
bx_transcoder_error_occured();
exit;
}
ob_end_clean();
if (!$oTranscoder->isFileReady($sHandler) && !$oTranscoder->transcode ($sHandler)) {
bx_transcoder_error_occured();
exit;
}
$sImageUrl = $oTranscoder->getFileUrl($sHandler);
if (!$sImageUrl) {
bx_transcoder_error_occured();
exit;
}
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $sImageUrl);
exit;
function bx_transcoder_error_occured($sMethod = 'displayPageNotFound')
{
require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
$oTemplate = BxDolTemplate::getInstance();
$oTemplate->$sMethod ();
}
/** @} */