Create thumbnail images

In the following function will create thumbnails .

function _createThumbnail($fileName) {
$config[‘image_library’] = ‘gd2′;
$config[‘source_image’] = ‘uploads/’ . $fileName;
$config[‘create_thumb’] = TRUE;
$config[‘maintain_ratio’] = TRUE;
$config[‘width’] = 75;
$config[‘height’] = 75;

$this->load->library(‘image_lib’, $config);
if(!$this->image_lib->resize()) echo $this->image_lib->display_errors();
}

Call the above function like :

$this->_createThumbnail($fInfo[‘file_name’]);

After creation of thumbnail clear the caches.

$this->image_lib->clear();

Hope that it will be useful.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: