aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/profile/actions/iconupload.php36
1 files changed, 22 insertions, 14 deletions
diff --git a/mod/profile/actions/iconupload.php b/mod/profile/actions/iconupload.php
index 10a55be1c..3c41f48a4 100644
--- a/mod/profile/actions/iconupload.php
+++ b/mod/profile/actions/iconupload.php
@@ -19,21 +19,29 @@
$medium = get_resized_image_from_uploaded_file('profileicon',100,100);
$large = get_resized_image_from_uploaded_file('profileicon',300,300);
- $filehandler = new ElggFile();
- $filehandler->setFilename($_SESSION['user']->username . "large.jpg");
- $filehandler->open("write");
- $filehandler->write($large);
- $filehandler->close();
- $filehandler->setFilename($_SESSION['user']->username . "medium.jpg");
- $filehandler->open("write");
- $filehandler->write($medium);
- $filehandler->close();
- $filehandler->setFilename($_SESSION['user']->username . "small.jpg");
- $filehandler->open("write");
- $filehandler->write($small);
- $filehandler->close();
+ if ($small !== false
+ && $medium !== false
+ && $large !== false) {
- system_message(elgg_echo("profile:icon:uploaded"));
+ $filehandler = new ElggFile();
+ $filehandler->setFilename($_SESSION['user']->username . "large.jpg");
+ $filehandler->open("write");
+ $filehandler->write($large);
+ $filehandler->close();
+ $filehandler->setFilename($_SESSION['user']->username . "medium.jpg");
+ $filehandler->open("write");
+ $filehandler->write($medium);
+ $filehandler->close();
+ $filehandler->setFilename($_SESSION['user']->username . "small.jpg");
+ $filehandler->open("write");
+ $filehandler->write($small);
+ $filehandler->close();
+
+ system_message(elgg_echo("profile:icon:uploaded"));
+
+ } else {
+ system_message(elgg_echo("profile:icon:notfound"));
+ }
} else {