I am having the following block of code in my function:
$target_path = \"uploads/\";
$target_path = $target_path . basename( $_FILES[\'image\'][\'name\'
Best is to use client side tools to resize the image locally, then upload. You can resize on the server side too (using php gd) but php copies the file in memory and by default, it can only resize images upto +/- 2MB. You can restrict uploading size and resize using php or you can use Flash, Silverlight or JavaApplets.
Here is another question about client side resizing using flash
UPDATE:
Example for serverside resize using CI's Image Manipulation lib
$config['image_library'] = 'gd2';
$config['source_image'] = $_FILES['image']['tmp_name'];
$config['new_image'] = $target_path
$config['maintain_ratio'] = TRUE;
$config['width'] = 250;
$config['height'] = 400;
$this->load->library('image_lib', $config);
if (!$this->image_lib->resize()) {
echo $this->image_lib->display_errors();
}
More info about the resizing lib