기본적으로 이미지를 크기가 다른 두 개의 이미지로 리사이즈하려고합니다. 그러나 처음에만 크기를 조정할 수 있습니다 featured_$filename
thumb_$filename
크기를 조정할 수 없습니다.Codeigniter 이미지 리사이즈 하나의 이미지 리사이즈
처음에는 하나의 함수를 만들고 구성을 배열로 전달했지만 작동하지 않았지만 똑같은 것으로, 단일 이미지의 크기가 조정되었습니다.
$this->resizeImage($imagePath, $file['upload_data']['file_name']);
$this->resizeThumb($imagePath, $file['upload_data']['filename']);
public function resizeImage($imagePath, $filename){
$config['image_library'] = 'gd2';
$config['source_image'] = $imagePath;
$config['create_thumb'] = FALSE;
$config['new_image'] = 'featured_'.$filename;
$config['maintain_ratio'] = TRUE;
$config['width'] = 570;
$config['height'] = 372;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
}
public function resizeThumb($imagePath, $filename){
$config['image_library'] = 'gd2';
$config['source_image'] = $imagePath;
$config['create_thumb'] = FALSE;
$config['new_image'] = 'thumb_'.$filename;
$config['maintain_ratio'] = TRUE;
$config['width'] = 180;
$config['height'] = 135;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
}
멋지게 형식화 된 답변입니다. 내가 일단 확인하면 대답을 받아 들일 것이다. 감사 . – prakashchhetri
그것이 효과가 있었습니까? –