diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-04 18:35:48 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-04 18:35:48 +0000 |
commit | a7ab0d0d8b2b2be2a331125d0e6d3d2734b91f69 (patch) | |
tree | 1781825422ae26964ce4a680a0c90ee79fafb81e /mod/groups/actions/edit.php | |
parent | 6faba7480f02a248ba9d10c59c9a92f27aac48a1 (diff) | |
download | elgg-a7ab0d0d8b2b2be2a331125d0e6d3d2734b91f69.tar.gz elgg-a7ab0d0d8b2b2be2a331125d0e6d3d2734b91f69.tar.bz2 |
Closes #109: Group icons can be set. Fixed recreate group on edit.
git-svn-id: https://code.elgg.org/elgg/trunk@1304 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups/actions/edit.php')
-rw-r--r-- | mod/groups/actions/edit.php | 48 |
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")); |