[eluser]ebuoe[/eluser]
Code:
/****************************************************************************************************************************************************/
///start the create thumb function this is used in the set avatar function to create the avatar thumb
function create_thumb($thumb_name)
{
/*check if user is logged in*/
if($this->session->userdata('user_id'))
{
//set the path to were the image is
$dir = "./path/avatar";
//set the path to were the thumb should be sent
$new = "./path/avatar/thumbs";
//set the configuration to be used for image resizing
$config['image_library'] = 'gd2';
$config['source_image'] = $dir;
$config['new_image'] = $new;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 35;
$config['height'] = 50;
//load the image library for image reszing
$this->load->library('image_lib', $config);
//resize image
$this->image_lib->resize();
}//end if eles user is logged in ($this->session->userdata('user_id'))
//else redirect to the home page
else
{
redirect('index','location');
}
}//end function to create