Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function doinsertdata(){
- //$id_kategori= $_POST['id_kategori'];
- $judul = $_POST['judul'];
- $cover = $_FILES['cover']['name'];
- $tipebaru = explode(".",$cover);
- $tipebaru2 = $tipebaru['1'];
- $filebaru3 = str_replace(' ','_',$judul);
- $file_input = 'cover';
- $data_insert = array(
- //'kode_kategori' => $id_kategori,
- 'judul_kategori' => $judul,
- 'cover' => $filebaru3.'.'.$tipebaru2,
- );
- $rby = $this->mymodel->Insertdata('kategori',$data_insert);
- $image_source2 = base_url()."uploads/";
- //script upload start
- $config['remove_spaces'] = TRUE;
- $config['file_name'] = $filebaru3.'.'.$tipebaru2 ;
- $config['upload_path'] = './uploads/';
- $config['allowed_types'] = 'gif|jpg|png';
- $config['max_size'] = '100000';
- $config['max_width'] = '102400';
- $config['max_height'] = '76800';
- $this->load->library('upload', $config);
- $this->upload->do_upload($file_input);
- $this->upload->data();
- //script upload end
- //script resize start
- $config['image_library'] = 'gd2';
- $config['source_image'] = ubah isinya sesuai dengan path dimana foto yg akan anda resize disimpan;
- $config['create_thumb'] = TRUE;
- $config['maintain_ratio'] = TRUE;
- $config['width'] = 200;
- $config['height'] = 200;
- $this->load->library('image_lib',$config);
- $this->image_lib->resize();
- //script resize end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement