[eluser]-sek[/eluser]
Thanks. That worked. For reference, this is the code.
Code:
/**
* Create thumbnail and original image. Rename to
* format specifying user identity.
*/
$data = array('upload_data' => $this->upload->data());
$img = $this->upload->data();
$id = $this->db_session->userdata('id');
// create profile icon image
$config['new_image'] = $img['file_path'] .'picture-profile-'. $id .'-i'. $img['file_ext'];
$config['image_library'] = 'gd2';
$config['source_image'] = $img['full_path'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 48;
$config['height'] = 48;
$this->load->library('image_lib', $config);
if ( ! $this->image_lib->resize())
{
echo $this->image_lib->display_errors();
}
// create original image
$config['new_image'] = $img['file_path'] .'picture-profile-'. $id .'-o'. $img['file_ext'];
$config['image_library'] = 'gd2';
$config['source_image'] = $img['full_path'];
$config['create_thumb'] = FALSE;
//$config['thumb_marker'] = 't';
$config['maintain_ratio'] = TRUE;
$config['width'] = 320;
$config['height'] = 200;
$this->image_lib->initialize($config);
if ( ! $this->image_lib->resize())
{
echo $this->image_lib->display_errors();
}
$this->load->view('picture_upload_success', $data);
}
// delete uploaded image
unlink($img['full_path']);