aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/actions/edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups/actions/edit.php')
-rw-r--r--mod/groups/actions/edit.php48
1 files changed, 47 insertions, 1 deletions
diff --git a/mod/groups/actions/edit.php b/mod/groups/actions/edit.php
index c8eebbd84..b5502115b 100644
--- a/mod/groups/actions/edit.php
+++ b/mod/groups/actions/edit.php
@@ -59,7 +59,53 @@
$group->save();
- $group->join($user); // Creator always a member
+ if (!$group->isMember($user))
+ $group->join($user); // Creator always a member
+
+
+ // Now see if we have a file icon
+ if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/')))
+ {
+ $prefix = "groups/".$group->guid;
+
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $group->owner_guid;
+ $filehandler->setFilename($prefix . ".jpg");
+ $filehandler->open("write");
+ $filehandler->write(get_uploaded_file('icon'));
+ $filehandler->close();
+
+ $thumbtiny = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),25,25, true);
+ $thumbsmall = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),40,40, true);
+ $thumbmedium = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),100,100, true);
+ $thumblarge = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),200,200, false);
+ if ($thumbtiny) {
+
+ $thumb = new ElggFile();
+ $thumb->setMimeType('image/jpeg');
+
+ $thumb->setFilename($prefix."tiny.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbtiny);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."small.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbsmall);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."medium.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbmedium);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."large.jpg");
+ $thumb->open("write");
+ $thumb->write($thumblarge);
+ $thumb->close();
+
+ }
+ }
system_message(elgg_echo("groups:saved"));