issue was the ROOT static, not gzip

This commit is contained in:
Pachira 2015-04-01 17:46:10 +02:00
parent 8c9eb07ca8
commit c15f472d8d
2 changed files with 60 additions and 59 deletions

View file

@ -18,8 +18,9 @@ error_reporting(-1);
ini_set('log_errors', 1);
ini_set('error_log', ROOT .'errors.log');
// Start output buffering
ob_start();
// Start output buffering with gzip and no gzip fallback
if(!ob_start('ob_gzhandler'))
ob_start();
// Include Configuration
require_once ROOT .'_sakura/config/config.php';

View file

@ -1,57 +1,57 @@
<?php
/*
* Sakura user image serving
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once '/var/www/flashii.net/_sakura/sakura.php';
// Set Content type
header('Content-Type: application/octet-stream');
// Check if the m(ode) GET request is set
if(isset($_GET['m'])) {
switch($_GET['m']) {
case 'avatar':
// Set path to no avatar picture
$noAvatar = ROOT_DIRECTORY .'content/img/no-av.png';
// If ?u= isn't set or if it isn't numeric
if(!isset($_GET['u']) || !is_numeric($_GET['u'])) {
$serveImage = $noAvatar;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = empty(Users::getUser($_GET['u'])['avatar_url']) ? $noAvatar : Users::getUser($_GET['u'])['avatar_url'];
break;
case 'background':
// Set path to no avatar picture
$noBackground = ROOT_DIRECTORY .'content/pixel.png';
// If ?u= isn't set or if it isn't numeric
if(!isset($_GET['u']) || !is_numeric($_GET['u'])) {
$serveImage = $noBackground;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = empty(Users::getUser($_GET['u'])['profilebg']) ? $noBackground : Users::getUser($_GET['u'])['profilebg'];
break;
default:
$serveImage = ROOT_DIRECTORY .'content/pixel.png';
}
} else {
$serveImage = ROOT_DIRECTORY .'content/pixel.png';
}
$serveImage = file_get_contents($serveImage);
header('Content-Type: ' .getimagesizefromstring($serveImage)['mime']);
print $serveImage;
<?php
/*
* Sakura user image serving
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once '/var/www/flashii.net/_sakura/sakura.php';
// Set Content type
header('Content-Type: application/octet-stream');
// Check if the m(ode) GET request is set
if(isset($_GET['m'])) {
switch($_GET['m']) {
case 'avatar':
// Set path to no avatar picture
$noAvatar = ROOT .'content/img/no-av.png';
// If ?u= isn't set or if it isn't numeric
if(!isset($_GET['u']) || !is_numeric($_GET['u'])) {
$serveImage = $noAvatar;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = empty(Users::getUser($_GET['u'])['avatar_url']) ? $noAvatar : Users::getUser($_GET['u'])['avatar_url'];
break;
case 'background':
// Set path to no avatar picture
$noBackground = ROOT .'content/pixel.png';
// If ?u= isn't set or if it isn't numeric
if(!isset($_GET['u']) || !is_numeric($_GET['u'])) {
$serveImage = $noBackground;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = empty(Users::getUser($_GET['u'])['profilebg']) ? $noBackground : Users::getUser($_GET['u'])['profilebg'];
break;
default:
$serveImage = ROOT .'content/pixel.png';
}
} else {
$serveImage = ROOT .'content/pixel.png';
}
$serveImage = file_get_contents($serveImage);
header('Content-Type: ' .getimagesizefromstring($serveImage)['mime']);
print $serveImage;