I have 2 codeigniter functions for image upload and thumb creation.The Image upload function is working properly but creating thumb function is not working. I don't Know What is the Mistake in my function?
function uploaded() //upload function
{
$config['upload_path'] ='./uploads/';
$config['allowed_types'] ='jpeg|jpg|png|gif|bmp|JPEG|JPG|PNG|GIF|BMP|doc|docx|xlsx|txt';
$config['max_size'] = $this->config->item('max_upload_size');
$filename = strtolower($this->friendly($_FILES['image']['name']));
$config['file_name'] = $filename;
$config['remove_spaces'] = TRUE;
$this->load->library('upload', $config);
if ($this->upload->do_upload('image'))
{
$this->data['file'] = $this->upload->data();
$this->thumb($filename);
return true;
}
}
create thumb function
function thumb($filename)
{
$config['image_library'] = 'gd2';
$config['source_image'] = './uploads/'.$filename.'.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$config['new_image'] = './uploads/thumb/'.$filename;
$this->load->library('image_lib', $config);
$this->image_lib->initialize($config);
$this->image_lib->resize();
}