2015-01-13 5 views
0

64x64 축소판에 맞게 이미지의 크기를 조정해야합니다. 내가하고있는 것? 폭과 높이의 크기를 64px로 설정했습니다. $ config [ 'maintain_ratio'] = false로 설정하면 이미지의 비율이 감소합니다. 내가 한 일 : $ config [ 'maintain_ratio'] = TRUE; $ config [ 'master_dim'] = '너비'; 너비는 항상 64px이지만 높이는 더 큽니다. 나는 어떻게 든 이미지 높이를 바닥에서 64px로 자릅니다. 이것을 어떻게 할 수 있습니까? 작물 기능을 설정하려했지만 실패했습니다. 어쩌면 또 다른 해결책은 설정 $로 ... 내 크기 조정 기능Codeigniter 크기 조정 및 자르기 이미지

private function resize($up_data) { 
     $config['image_library'] = 'gd2'; 
     $config['source_image'] = $up_data['full_path']; 
     $config['new_image']  = './images/autoriaithumb/'; 
     $config['create_thumb'] = TRUE; 
     $config['maintain_ratio'] = TRUE; 
     $config['thumb_marker'] = '_thumb'; 
     $config['width']   = 64; 
     $config['height']   = 64; 
     $config['quality']  = 100; 
     $config['master_dim'] = 'width'; 

     $this->image_lib->initialize($config); 

     $this->image_lib->resize(); 

}

답변

0

은 $ image_config로 '업로드 설정'을 정의하고 작물 구성을 정의하려고 ....이

$this->load->library('upload', $image_config); 
if ($this->upload->do_upload()) { 
    $this->load->library('image_lib',$config); 
    $this->image_lib->resize(); 
} 
+0

나는 시도 할 것이고, 또한 아래에서 이미지를자를 필요가있다. 이것을 어떻게 할 수 있습니까? – anhelo

+0

[link] (https://ellislab.com/codeigniter/user-guide/libraries/image_lib.html)을 참조하십시오 ... $ this-> image_lib-> crop() 코드 크기를 변경하기 전이나 후에 코드를 작성하십시오. – parth

+0

더 이상 중요하지 않습니다. 나는 그것을 해결하는 방법을 발견했다. :) 도와 줘서 고마워. – anhelo