aboutsummaryrefslogtreecommitdiff
path: root/pages/avatar/view.php
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-10-29 10:57:05 -0400
committercash <cash.costello@gmail.com>2011-10-29 10:57:05 -0400
commit3ef53c9c97ec7f8e7022ca357a211531bde983c7 (patch)
tree47974330a077e4666e1e5a107649d99a118e031e /pages/avatar/view.php
parent0625897f1e47e6cb46c5e4f4d4b6d50f9dd48239 (diff)
downloadelgg-3ef53c9c97ec7f8e7022ca357a211531bde983c7.tar.gz
elgg-3ef53c9c97ec7f8e7022ca357a211531bde983c7.tar.bz2
Refs #3396 fixed the integration of this 1.7 fix into 1.8 and also added better expires header
Diffstat (limited to 'pages/avatar/view.php')
-rw-r--r--pages/avatar/view.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/pages/avatar/view.php b/pages/avatar/view.php
index 904a57610..bd6c95821 100644
--- a/pages/avatar/view.php
+++ b/pages/avatar/view.php
@@ -3,6 +3,7 @@
* View an avatar
*/
+// page owner library sets this based on URL
$user = elgg_get_page_owner_entity();
// Get the size
@@ -13,15 +14,17 @@ if (!in_array($size, array('master', 'large', 'medium', 'small', 'tiny', 'topbar
// If user doesn't exist, return default icon
if (!$user) {
- $url = "_graphics/icons/user/default{$size}";
+ $url = "_graphics/icons/default/{$size}.png";
$url = elgg_normalize_url($url);
forward($url);
}
+$user_guid = $user->getGUID();
+
// Try and get the icon
$filehandler = new ElggFile();
-$filehandler->owner_guid = $user->getGUID();
-$filehandler->setFilename("profile/" . $user->getGUID() . $size . ".jpg");
+$filehandler->owner_guid = $user_guid;
+$filehandler->setFilename("profile/{$user_guid}{$size}.jpg");
$success = false;
@@ -32,20 +35,20 @@ try {
}
}
} catch (InvalidParameterException $e) {
- elgg_log("Unable to get profile icon for user with GUID $entity->guid", 'ERROR');
+ elgg_log("Unable to get avatar for user with GUID $user_guid", 'ERROR');
}
if (!$success) {
- $url = "_graphics/icons/user/default{$size}.gif";
+ $url = "_graphics/icons/default/{$size}.png";
$url = elgg_normalize_url($url);
forward($url);
}
-header("Content-type: image/jpeg");
-header('Expires: ' . date('r', time() + 864000));
-header("Pragma: public");
-header("Cache-Control: public");
+header("Content-type: image/jpeg", true);
+header('Expires: ' . date('r', strtotime("+6 months")), true);
+header("Pragma: public", true);
+header("Cache-Control: public", true);
header("Content-Length: " . strlen($contents));
echo $contents;