sql >> Database teknologi >  >> RDS >> Mysql

komprimer billedstørrelse ved upload i codeigniter

$config['upload_path'] = './upload/';  
            $config['allowed_types'] = 'jpg|jpeg|png|gif';  
            $this->load->library('upload', $config);  
            if(!$this->upload->do_upload('image_file'))  
            {  
                 echo $this->upload->display_errors();  
            }  
            else  
            {  
                 $data = $this->upload->data();  
                 $config['image_library'] = 'gd2';  
                 $config['source_image'] = './upload/'.$data["file_name"];  
                 $config['create_thumb'] = FALSE;  
                 $config['maintain_ratio'] = FALSE;  
                 $config['quality'] = '60%';  
                 $config['width'] = 200;  
                 $config['height'] = 200;  
                 $config['new_image'] = './upload/'.$data["file_name"];  
                 $this->load->library('image_lib', $config);  
                 $this->image_lib->resize();  
                 $this->load->model('main_model');  
                 $image_data = array(  
                      'name'          =>     $data["file_name"]  
                      );  
                 $this->main_model->insert_image($image_data);  
                 echo $this->main_model->fetch_image();  
                 //echo '<img src="'.base_url().'upload/'.$data["file_name"].'" width="300" height="225" class="img-thumbnail" />';  
            }



  1. Fordelene ved at indeksere udenlandske nøgler

  2. Sådan filtrerer du i et til mange forhold med android room db

  3. Sådan beregnes median i MySQL

  4. Hvordan kalder man Oracle Stored Procedure i Python?