diff options
author | Sem <sembrestels@riseup.net> | 2012-12-07 23:55:12 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2012-12-07 23:55:12 +0100 |
commit | 3ed289b03fa3d851fd7fffbc0441ebc9b5e98310 (patch) | |
tree | b2c8d2d7f569f0e3e7bfa6711cef96f806aea9f1 /mod/profile/icondirect.php | |
parent | 2b2af5392f0daadc22a1db04aa17c17d4dd37c65 (diff) | |
parent | ccf7abb4b2b94781f9b67a6cf8798994aa1cca0d (diff) | |
download | elgg-3ed289b03fa3d851fd7fffbc0441ebc9b5e98310.tar.gz elgg-3ed289b03fa3d851fd7fffbc0441ebc9b5e98310.tar.bz2 |
Merge tag '1.8.11' of git://github.com/Elgg/Elgg
Elgg 1.8.11 release
Diffstat (limited to 'mod/profile/icondirect.php')
-rw-r--r-- | mod/profile/icondirect.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index c4439f78c..dbab5d31f 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -23,7 +23,7 @@ $guid = (int)$_GET['guid']; // If is the same ETag, content didn't changed. $etag = $last_cache . $guid; -if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"$etag\"") { header("HTTP/1.1 304 Not Modified"); exit; } @@ -55,19 +55,15 @@ if ($mysql_dblink) { $user_path = date('Y/m/d/', $join_date) . $guid; $filename = "$data_root$user_path/profile/{$guid}{$size}.jpg"; - $contents = @file_get_contents($filename); - if (!empty($contents)) { + $size = @filesize($filename); + if ($size) { header("Content-type: image/jpeg"); - header('Expires: ' . date('r', strtotime("+6 months")), true); + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true); header("Pragma: public"); header("Cache-Control: public"); - header("Content-Length: " . strlen($contents)); - header("ETag: $etag"); - // this chunking is done for supposedly better performance - $split_string = str_split($contents, 1024); - foreach ($split_string as $chunk) { - echo $chunk; - } + header("Content-Length: $size"); + header("ETag: \"$etag\""); + readfile($filename); exit; } } |