php - Compress image in Codeigniter

one text

Solution:

Some things are out of sequence here. First, upload the image, then initialize the resize, then resize

$do_upload1 = $this->upload->do_upload('bill_img'); 
if(!empty($do_upload1)) {
        $measur1 = 'uploads/order/'.$folder_name.'/'.$filename;

        // resize
        $resize_config['image_library'] = 'gd2';
        $resize_config['source_image'] = $do_upload1['file_path']; // full path to the image
        $resize_config['maintain_ratio'] = true;
        $resize_config['width'] = 100;
        $resize_config['quality'] = '60%';
        $this->load->library('image_lib', $resize_config);  
        $this->image_lib->resize();
}

Source