We're currently planning new Elgg core APIs for storing, cropping and serving icons. They won't however become available to plugin developers until Elgg 2.1 or 2.2. If you're not in a hurry, I'd recommend you to wait for it instead of implementing your own tool.
If you're in hurry, you can get started by taking a look at these files:
https://github.com/Elgg/Elgg/blob/1.12/pages/avatar/edit.php
https://github.com/Elgg/Elgg/blob/1.12/views/default/forms/avatar/crop.php
https://github.com/Elgg/Elgg/blob/1.12/actions/avatar/crop.php
If you want to help us design the new APIs, take a look at these:
https://github.com/Elgg/Elgg/issues/6152
https://github.com/Elgg/Elgg/issues/9120
https://github.com/Elgg/Elgg/pull/8202
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.