I want to create two thumbnails withh different sizes with two functions. uploadImage() makes big thumbnail while uploadIhumb($name){ it calls inside first function} create small thumbnail. FIRST FUNCTION CREATE THUMBNAIL BUT SECOND DOES NOT WORK. please solve the problem and highlight where problem occured?
enter code here:
function uploadImage()
{
$imageName2=$_FILES['file']['tmp_name'];
$config['image_library'] = 'gd2';
//$config['source_image'] = $imageName2;// this is temporary folder where image place on uploading time
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = false;
$config['width'] = 696;
$config['height'] = 241;
$config['new_image'] = 'images/uploads';
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$file_name= basename( $imageName2, ".tmp");
$filename=$file_name.'_thumb.tmp';
////////////////////Rename code///////////////////////////
$name= $this->rand_string( 6 );
$dir=$_SERVER['DOCUMENT_ROOT'].'/images/uploads/';
rename($dir . $filename, $dir . $name);
echo $name;
$this->uploadIhumb($name); //FUNCTION CALL
}
function uploadIhumb($name)
{
$config['image_library'] = 'gd2';
$config['source_image'] = $_SERVER['DOCUMENT_ROOT'].'/images/uploads/'.$name;
$config['create_thumb'] = TRUE;
$config['width'] = 80;
$config['height'] = 80;
$config['new_image'] = $_SERVER['DOCUMENT_ROOT'].'images/uploads/thumbs/';
$this->load->library('image_lib', $config);
$this->image_lib->resize();
}