47 lines
1002 B
PHP
47 lines
1002 B
PHP
<?php
|
|
ob_start();
|
|
chdir('..');
|
|
require_once ('api/Simpla.php');
|
|
|
|
$filename = $_GET['file'];
|
|
$token = $_GET['token'];
|
|
|
|
$filename = str_replace('%2F', '/', $filename);
|
|
|
|
if(substr($filename, 0, 6) == 'http:/')
|
|
$filename = 'http://'.substr($filename, 6);
|
|
|
|
$simpla = new Simpla();
|
|
|
|
//if (!$simpla->config->check_token($filename, $token))
|
|
// exit('bad token');
|
|
|
|
$resized_filename = $simpla->image->resize($filename); //
|
|
ob_end_clean();
|
|
//echo '--'.$resized_filename;
|
|
//if(is_readable($resized_filename))
|
|
// header('Location: '.$_SERVER['REQUEST_URI']);
|
|
|
|
if (is_readable($resized_filename))
|
|
{
|
|
header('Content-type: image');
|
|
print file_get_contents($resized_filename);
|
|
}else{
|
|
header("HTTP/1.0 404 Not Found");
|
|
header("Status: 404 Not Found");
|
|
$_SERVER['REQUEST_URI'] = '/404/';
|
|
|
|
session_start();
|
|
|
|
require_once('view/IndexView.php');
|
|
|
|
$view = new IndexView();
|
|
|
|
$_GET['page_url'] = '404';
|
|
$_GET['module'] = 'PageView';
|
|
print $view->fetch();
|
|
|
|
//Header( "Location: /404/" );
|
|
//exit;
|
|
}
|