diff options
author | cash <cash.costello@gmail.com> | 2011-10-29 10:57:05 -0400 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2011-10-29 10:57:05 -0400 |
commit | 3ef53c9c97ec7f8e7022ca357a211531bde983c7 (patch) | |
tree | 47974330a077e4666e1e5a107649d99a118e031e /pages | |
parent | 0625897f1e47e6cb46c5e4f4d4b6d50f9dd48239 (diff) | |
download | elgg-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')
-rw-r--r-- | pages/avatar/view.php | 21 |
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; |