Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function addNewUser() {
- $this->load->helper(array('form','file','url'));
- $config_image = array();
- $config_image['upload_path'] = './assets/uploads';
- $config_image['allowed_types'] = 'gif|jpg|png|jpeg';
- $config_image['max_size'] = '1024';
- $this->load->library('upload', $config_image);
- if (! $this->upload->do_upload('profilepic') ){
- $upload_data = $this->upload->data();
- $file_name = $upload_data['file_name'];
- $data = array(
- 'success' => 1
- );
- }else{
- $upload_data = $this->upload->data();
- $file_name = $upload_data['file_name'];
- $this->image_resize($upload_data['full_path'], $file_name);
- $data = array(
- 'success' => 1
- );
- }
- $img = array(
- 'profilepic' => $file_name
- );
- $fname = $this->input->post('txtfname');
- $mname = $this->input->post('txtmname');
- $lname = $this->input->post('txtlname');
- $email = $this->input->post('txtemail');
- $user = $this->input->post('txtuser');
- $pass = $this->input->post('txtpass');
- $position = $this->input->post('txtposition');
- $schoolID = $this->input->post('txtschoolID');
- $this->model->addNewUser($fname, $mname, $lname, $email, $user, $pass, $position, $schoolID, $img);
- generate_json($data);
- }
- public function image_resize($path, $file){
- $config_resize = array();
- $config_resize['image_library'] = 'gd2';
- $config_resize['source_image'] = $path;
- $config_resize['maintain_ratio'] = TRUE;
- $config_resize['width'] = 75;
- $config_resize['height'] = 50;
- $config_resize['new_image'] = '../assets/uploads'.$file;
- $this->load->library('image_lib',$config_resize);
- $this->image_lib->resize();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement