$thumb->open("write"); $thumb->write($thumbs[$size]); $thumb->close(); } $group->icontime = time(); } } // @todo Remove this when #4683 fixed if ($must_move_icons) { $filehandler = new ElggFile(); $filehandler->setFilename('groups'); $filehandler->owner_guid = $old_owner_guid; $old_path = $filehandler->getFilenameOnFilestore(); $sizes = array('', 'tiny', 'small', 'medium', 'large'); if ($has_uploaded_icon) { // delete those under old owner foreach ($sizes as $size) { unlink("{$old_path}/{$group_guid}{$size}.jpg"); } } else { // move existing to new owner $filehandler->owner_guid = $group->owner_guid; $new_path = $filehandler->getFilenameOnFilestore(); foreach ($sizes as $size) { rename("{$old_path}/{$group_guid}{$size}.jpg", "{$new_path}/{$group_guid}{$size}.jpg"); } } } system_message(elgg_echo("groups:saved")); forward($group->getUrl());