aboutsummaryrefslogtreecommitdiff
path: root/mod/profile/icondirect.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-12-14 14:21:32 -0200
committerSilvio Rhatto <rhatto@riseup.net>2012-12-14 14:21:32 -0200
commitf9ca24a9407f294a9bb7305180f9f8e740ab6ec9 (patch)
tree4c9a263b7fd770151e40940d6ddaa89d27e5053d /mod/profile/icondirect.php
parente15f0fce6940ee999cf5d6405ad1b16d00c38e4b (diff)
parent3ed289b03fa3d851fd7fffbc0441ebc9b5e98310 (diff)
downloadelgg-f9ca24a9407f294a9bb7305180f9f8e740ab6ec9.tar.gz
elgg-f9ca24a9407f294a9bb7305180f9f8e740ab6ec9.tar.bz2
Merge branch 'master' of git://gitorious.org/lorea/elgg into saravea
Diffstat (limited to 'mod/profile/icondirect.php')
-rw-r--r--mod/profile/icondirect.php18
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;
}
}