[eluser]Pawel K[/eluser]
I have been trying to use the image library to resize an image in to a 400x400 thumbnail as well as a 200x200 thumb. I am able to do only the first image, I would appreciate any help in understanding why this is happening.
Code:
$image_info = $this->upload->data();
$uploaded_name = $image_info['raw_name'];
$uploaded_ext = $image_info['file_ext'];
chmod($image_info['full_path'], 0777);
$thumb_name = $image_info['raw_name']."-thumb".$image_info['file_ext'];
$big_name = $image_info['raw_name']."-main".$image_info['file_ext'];
#Main Image
$config['image_library'] = 'gd2';
$config['source_image'] = $image_info['full_path'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = $this->config->item('img_width');
$config['height'] = $this->config->item('img_height');
$config['new_image'] = $big_name;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
#Thumb Image
$config['image_library'] = 'gd';
$config['source_image'] = $image_info['file_path'].$big_name;
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = FALSE;
$config['width'] = $this->config->item('thumb_width');
$config['height'] = $this->config->item('thumb_height');
$config['new_image'] = $thumb_name;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
echo "Image 1 errors:".$this->image_lib->display_errors()."<br>";
#Post Data
$prod_name = $this->input->post('product_name');
$prod_description = $this->input->post('product_desc');
$prod_price = $this->input->post('product_price');
$prod_cat = $this->input->post('category');
Only the first thumbnail (main) gets created. The second one doesn't. No errors show up.