php - Multiple resizing in CodeIgniter -
i need make 2 images of single loaded picture. images must have fixed width, - 180 , 300 pixels.
at bottom of current results. function can resize , create 1 of 2 images. failed on second image, trying whole day, i'm can't find reason. need help.
$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'm use codeigniter 2.02
nill
think problem takes place because on first run script moves initial file folder. try use:
$config['new_image'] = base_url() . 'img/'; instead of
$config['dest_image'] = base_url() . 'img/';
Comments
Post a Comment