调整大小并旋转图像 - Codeigniter

I'm trying to resize and rotate a image.

At the moment it's only resizing the image, but not rotate it.

Here is the code, hope someone have a solution or something :-)

$config['image_library']   = 'gd2';
$config['source_image']    = $data['full_path'];
$config['new_image']       = $data['file_path'].'thumbs/'.$data['file_name'];
$config['create_thumb']    = FALSE;
$config['maintain_ratio']  = TRUE;
$config['width']           = 235;
$config['height']          = 235;

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

$this->image_lib->resize();

$this->image_lib->clear();

$config['create_thumb'] = FALSE; //No thumbnail
$config['source_image'] = $data['file_path'].'thumbs/'.$data['file_name']; //full path for the source image
$config['rotation_angle'] = '180';// 

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

//Rotate the image
$this->image_lib->rotate();

After

$this->image_lib->clear();

add:

$config = array() to re-initialise your config array.

Make sure you recreate the $config before sending it again.

Otherwise you might end up sending values you don't want to send.

At the moment rotate() gets a $config like this:

$config['image_library']   = 'gd2';
$config['new_image']       = $data['file_path'].'thumbs/'.$data['file_name'];
$config['maintain_ratio']  = TRUE;
$config['width']           = 235;
$config['height']          = 235;
$config['create_thumb'] = FALSE; //No thumbnail
$config['source_image'] = $data['file_path'].'thumbs/'.$data['file_name']; //full path for the source image
$config['rotation_angle'] = '180'; //

After clearing the configuration, don't reload the library, reinitialize it:

$this->image_lib->clear();
$config=array();
$config['image_library']   = 'gd2';
$config['source_image'] = $data['file_path'].'thumbs/'.$data['file_name'];
$config['rotation_angle'] = '180';
$this->image_lib->initialize($config); // reinitialize it instead of reloading
$this->image_lib->rotate();

This is the only solution that finally worked for me. Just re-initialising $config did not work out in CodeIgniter 2.2.0.