Welcome Guest, Not a member yet? Register   Sign In
Use upload librairie with generated picture
#1
Question 

Hi,
I use upload librarie to send my picture on database/folder, and it work fine. Now, i juste jquery cropper (Croppie.js) and recieve the data of image in data64 format. I want to know, how use Upload Librarie with data64 img in input type text ?

I try (controller just under) to define my picture generated ($img_handler) on the do_upload function. (But its dont work).
I juste want to recieve my picture on data64 format and use librarie upload to encrypt, upload_path... 

Do you have solution ?
Thanks!  

Code:
   public function addBand()
   {
       $config['upload_path']   = './uploads/bands';
       $config['allowed_types'] = 'gif|jpg|png';
       $config['encrypt_name'] = TRUE;
       $this->load->library('upload', $config);

       $img64 = $this->input->post('imagebase64');
       $exploded = explode(',', $img64, 2);
       $encoded = $exploded[1];
       $decoded = base64_decode($encoded);
       $img_handler = imagecreatefromstring($decoded);


       if ( ! $this->upload->do_upload('picture')) {
           $error = array('error' => $this->upload->display_errors());
           $this->session->set_flashdata('error', $error);
           $this->load->view('concerts/index');
       }

       else {
           $upload_data = $this->upload->data('file_name');
           $file_name = $upload_data['file_name'];

           $data = array(
               'bName' => $this->input->post('name'),
               'bPicture' => $file_name
           );
           
           $this->session->set_flashdata('success', "Groupe ajouté");
           redirect('');
       }
   }
Reply




Theme © iAndrew 2016 - Forum software by © MyBB