Codeigniter image resize?

前端 未结 6 1430
故里飘歌
故里飘歌 2020-11-28 14:43

I have problem with image class in CI?

This is example

On controller:

$this->load->library( array(\'image_lib\') );

O

6条回答
  •  猫巷女王i
    2020-11-28 15:37

    $config['upload_path']          = './berkas/content/';
    $config['allowed_types']        = 'gif|jpg|png';
    $config['max_size']             = 0;
    $config['max_width']            = 1024000;
    $config['max_height']           = 7680000;
    $config['encrypt_name']           = TRUE;
    $config['overwrite']           = FALSE;
    
    $this->load->library('upload', $config);
    
            $upload_data = $this->upload->data();
            $file_name = $upload_data['file_name'];            
            $params['gambar'] = $file_name;
            $this->load->library('image_lib');
            $config['image_library'] = 'gd2';
            $config['source_image'] = './berkas/content/'.$file_name;
            $config['create_thumb'] = FALSE;
            $config['maintain_ratio'] = TRUE;
            $config['width']     = 550;
            $config['height']   = 350;
    
    $params = array('gambar' => $file_name);
    

提交回复
热议问题