class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
I am not familiar with Code Igniter, but from what I can see here, it should be possible to integrate the upload class in the framework, and extend its current upload capabilities.
It looks to me that
if ( ! $this->upload->do_upload())
should wrap the process() function of class.upload.phpReply
It looks to me that
should wrap the process() function of class.upload.php