I need to make two images of one uploaded image. These images should have a fixed width - 180 and 300 pixels.
Below my current results. This function can resize and create only one of two images. Everyone failed in the second image, I try all day, but I can not find the reason. Help is needed.
$this->_resize($data['upload_data']['file_name'], 300); $this->_resize($data['upload_data']['file_name'], 180); private function _resize($file_name, $size) { $config['image_library'] = 'gd2'; $config['source_image'] = 'img/upload/' . $file_name; $config['dest_image'] = base_url() . 'img/'; $config['create_thumb'] = TRUE; $config['thumb_marker'] = '_' . $size; $config['maintain_ratio'] = FALSE; $config['width'] = $size; $config['height'] = $size; $this->load->library('image_lib', $config); $result = $this->image_lib->resize(); $this->image_lib->clear(); return; }
I am using CodeIgniter 2.02
source share