From a7ab0d0d8b2b2be2a331125d0e6d3d2734b91f69 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 4 Jul 2008 18:35:48 +0000 Subject: 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 --- mod/groups/actions/edit.php | 48 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'mod/groups/actions/edit.php') 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")); -- cgit v1.2.3