sql >> Base de Datos >  >> RDS >> Mysql

comprimir el tamaño de la imagen al cargar en 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" />';  
            }