gd2 image resizing library in codeigniter

Step 1: Load the image manipulation library in CodeIgniter using the following code:

$this->load->library('image_lib');

Step 2: Set the image path and initialize the image library configuration:

$config['image_library'] = 'gd2';
$config['source_image'] = 'path_to_source_image';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$this->image_lib->initialize($config);

Step 3: Resize the image using the configuration and clear the image library settings:

$this->image_lib->resize();
$this->image_lib->clear();