You can do this with the codeigniter image manipulation class.
Just create a helper with your image resize code, here is a basic example:
In the Helper
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
if ( ! function_exists('generate_image'))
{
function generate_image($img, $width, $height){
$obj =& get_instance();
$obj->load->library('image_lib');
$obj->load->helper('url');
$config['image_library'] = 'gd2';
$config['source_image'] = $img;
$config['new_image'] = './resources/images/img_tp/tn_img.png' ;
$config['width'] = $width;
$config['height'] = $height;
$obj->image_lib->initialize($config);
$obj->image_lib->resize();
return $config['new_image'];
}
}
Name as you wish and ensure to load the helper in your controller constructer.
Then in your view:
<img src="<?php echo generate_image($img, $width, $height); ?>" />
You can create a set of functions in the helper to perform different manipulation tasks and use them directly in your view using this method.
Here is the image manipulation documentation. http://codeigniter.com/user_guide/libraries/image_lib.html