[eluser]ywftdg[/eluser]
Wonderful, got it all
working, thanks Codex! I thought I would post the final code so maybe will help another newb like me in the future.
Code:
if (!$this->upload->do_upload()) {
$data['error'] = 'There was a problem with your upload!'; // If something goes wrong
} else { // all is well, lets go!
$data = array('upload_data' => $this->upload->data()); // Get the file from the form userfile information
$file = $data['upload_data']['file_name']; // set the file variable
$filenew = rename($dir . $file, $dir . $id.'.jpg'); //basic php rename call, rename my upload now that upload finished
$data = array( // this array is all the other values from my form fields
$this->input->post('nickname'),
$this->input->post('bio'),
$this->input->post('web'),
$filenew
);
$configB['image_library'] = 'gd2'; // this code begins the thumbnail making process, from user guide
$configB['source_image'] = $dir . $id.'.jpg'; // I am using $id for image name, which is my users id, comes form the session
$configB['create_thumb'] = TRUE;
$configB['maintain_ratio'] = TRUE;
$configB['width'] = 57;
$configB['height'] = 40;
$this->load->library('image_lib', $configB);
$this->image_lib->resize();
$this->designer->update_mypage($id,$data); // run my model which saves all this to the database, image name also ($filenew)
$this->session->set_flashdata('message', 'Mypage Updated!'); // sets a session to flash data on page reload to say this has completed
redirect('designers/mypage'); // redirect to the page with the session data ready
}
}