load->library('upload', $config); if (!$this->upload->do_upload("file")) { $status['error'] =$this->upload->display_errors('', ''); //untuk status kalo format tidak sesuai configurasi $status['status'] = 2; } else { $raw_name = $this->upload->data('raw_name'); $inputFileName = $this->upload->data('file_name'); $file_ext = $this->upload->data('file_ext'); $config['image_library'] = 'gd2'; $config['source_image'] = $this->upload->data('full_path'); $config['create_thumb'] = TRUE; $config['maintain_ratio'] = TRUE; $config['width'] = 48; $config['height'] = 48; $this->load->library('image_lib', $config); $this->image_lib->resize(); $status['status'] = 1; } }else{ $status['error']='Pilih Foto'; $status['status'] = 3; } echo json_encode($status); } } ?>