function profile_image_upload() { $imagetype = $this->input->post('imageType'); $filename = $_FILES['photoimg']['name']; $size = $_FILES['photoimg']['size']; $ext = $this->getExtension($filename); $ext = strtolower($ext); $actual_image_name = 'admin' . $this->current_admin['id'] . '_cover_' . time() . "." . $ext; //config image upload $config['allowed_types'] = $this->config->item('acceptable_files'); $config['upload_path'] = $this->config->item('admin_upload_dir') . 'original'; $config['file_name'] = $actual_image_name; $config['remove_spaces'] = true; $this->load->library('upload', $config); if ($this->upload->do_upload('photoimg')) { $upload_data = $this->upload->data(); $this->load->library('image_lib'); //this is the larger image $config['image_library'] = 'gd2'; $config['source_image'] = $this->config->item('admin_upload_dir') . 'original/' . $upload_data['file_name']; $config['new_image'] = $this->config->item('admin_upload_dir') . 'source/' . $upload_data['file_name']; $config['maintain_ratio'] = TRUE; $config['width'] = 160; $config['height'] = 204; $this->image_lib->initialize($config); $this->image_lib->resize(); $this->image_lib->clear(); $data['file_name'] = $upload_data['file_name']; $param['admin_img'] = $data['file_name']; $param['id'] = $this->current_admin['id']; $uid = $this->auth->save($param); $image = (array) $this->auth->get_admin($this->current_admin['id']); if ($image) { echo '<img src="' . admin_profile_img($image['admin_img']) . '" style="top:0px"/>'; } } if ($this->upload->display_errors() != '') { echo $this->upload->display_errors(); } }
} }).submit(); }); }); </script> <?php echo theme_js('jquery.wallform.js', true); ?> <div id="nav-col"> <section id="col-left" class="col-left-nano"> <div id="col-left-inner" class="col-left-nano-content"> <div id="user-left-box" class="clearfix hidden-sm hidden-xs dropdown profile2-dropdown"> <div id="ProfilePic"> <img alt="" id="previousImage" src="<?php if (!empty($admin_img['admin_img'])) { echo admin_profile_img($admin_img['admin_img']); } else { echo theme_img('default.png'); } ?> " /> </div> <div class="user-box"> <span class="name"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Welcome <?php echo $name; ?> <i class="fa fa-angle-down"></i> </a>