image_lib codeigniter add _thumb

// Load the CodeIgniter Image Library
$this->load->library('image_lib');

// Set the source image path
$config['source_image'] = '/path/to/original/image.jpg';

// Set the destination path for the thumbnail
$config['new_image'] = '/path/to/thumbnail/image_thumb.jpg';

// Set the desired width and height for the thumbnail
$config['width'] = 100;
$config['height'] = 100;

// Maintain the original aspect ratio when resizing
$config['maintain_ratio'] = TRUE;

// Specify the image manipulation method (resize in this case)
$config['master_dim'] = 'auto';

// Initialize the image manipulation library with the configuration settings
$this->image_lib->initialize($config);

// Resize and create the thumbnail
$this->image_lib->resize();

// Clear the configuration settings for subsequent use
$this->image_lib->clear();