From 450b7bd52a3f1424699540dfcbb30703def67a00 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 16 Aug 2012 22:28:53 +0200 Subject: [PATCH] avatar serving works now --- .gitignore | 1 + data/surrogator.config.php | 8 -- data/surrogator.config.php.dist | 2 + www/.htaccess | 3 + www/avatar.php | 129 ++++++++++++++++++++++++++++++++ 5 files changed, 135 insertions(+), 8 deletions(-) delete mode 100644 data/surrogator.config.php create mode 100644 www/.htaccess create mode 100644 www/avatar.php diff --git a/.gitignore b/.gitignore index 4564537..76144a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ var/* raw/* +data/surrogator.config.php diff --git a/data/surrogator.config.php b/data/surrogator.config.php deleted file mode 100644 index 87efce0..0000000 --- a/data/surrogator.config.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/data/surrogator.config.php.dist b/data/surrogator.config.php.dist index 421e057..87efce0 100644 --- a/data/surrogator.config.php.dist +++ b/data/surrogator.config.php.dist @@ -3,4 +3,6 @@ $rawDir = __DIR__ . '/../raw/'; $varDir = __DIR__ . '/../var/'; $sizes = array(16, 32, 48, 64, 80, 96, 128, 256, 512); $maxSize = 512; +$logLevel = 1;//0 - nothing, 3 - high +$forceUpdate = false; ?> diff --git a/www/.htaccess b/www/.htaccess new file mode 100644 index 0000000..4b6a45e --- /dev/null +++ b/www/.htaccess @@ -0,0 +1,3 @@ +RewriteEngine On +RewriteBase / +RewriteRule ^avatar/ avatar.php [L] diff --git a/www/avatar.php b/www/avatar.php new file mode 100644 index 0000000..9a17a33 --- /dev/null +++ b/www/avatar.php @@ -0,0 +1,129 @@ += $stat['mtime'] +) { + header('Last-Modified: ' . date('r', $stat['mtime'])); + header('HTTP/1.0 304 Not Modified'); + exit(); +} + +header('Last-Modified: ' . date('r', $stat['mtime'])); +header('Etag: "' . $etag . '"'); +header('Content-Type: image/png'); +header('Content-Length:' . $stat['size']); + +readfile($imgFile); +?> \ No newline at end of file -- 2.30.2