From 11c1b520e80ced1a7f226da0bd5faaaffb11becf Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 21 May 2008 14:55:17 +0000 Subject: Assorted profile icon fixes git-svn-id: https://code.elgg.org/elgg/trunk@668 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/actions/iconupload.php | 7 ++++--- mod/profile/icon.php | 14 +++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'mod/profile') diff --git a/mod/profile/actions/iconupload.php b/mod/profile/actions/iconupload.php index 3c41f48a4..c30ee084d 100644 --- a/mod/profile/actions/iconupload.php +++ b/mod/profile/actions/iconupload.php @@ -24,15 +24,16 @@ && $large !== false) { $filehandler = new ElggFile(); - $filehandler->setFilename($_SESSION['user']->username . "large.jpg"); + $filehandler->owner_guid = $_SESSION['user']->getGUID(); + $filehandler->setFilename("profile/" . $_SESSION['user']->username . "large.jpg"); $filehandler->open("write"); $filehandler->write($large); $filehandler->close(); - $filehandler->setFilename($_SESSION['user']->username . "medium.jpg"); + $filehandler->setFilename("profile/" . $_SESSION['user']->username . "medium.jpg"); $filehandler->open("write"); $filehandler->write($medium); $filehandler->close(); - $filehandler->setFilename($_SESSION['user']->username . "small.jpg"); + $filehandler->setFilename("profile/" . $_SESSION['user']->username . "small.jpg"); $filehandler->open("write"); $filehandler->write($small); $filehandler->close(); diff --git a/mod/profile/icon.php b/mod/profile/icon.php index dd87ff939..c201d7716 100644 --- a/mod/profile/icon.php +++ b/mod/profile/icon.php @@ -26,9 +26,17 @@ // Try and get the icon $filehandler = new ElggFile(); - $filehandler->setFilename($username . $size . ".jpg"); - if ($filehandler->open("read") && $contents = $filehandler->read($filehandler->size())) { - } else { + $filehandler->owner_guid = $user->getGUID(); + $filehandler->setFilename("profile/" . $username . $size . ".jpg"); + + $success = false; + if ($filehandler->open("read")) { + if ($contents = $filehandler->read($filehandler->size())) { + $success = true; + } + } + + if (!$success) { global $CONFIG; $contents = @file_get_contents($CONFIG->pluginspath . "profile/graphics/default{$size}.jpg"); -- cgit v1.2.3