In the following function will create thumbnails in codeigniter.
<? PHP
? >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 :
<? PHP
? >$this->_createThumbnail($fInfo['file_name']);
After creation of thumbnail clear the caches.
<? PHP
? >$this->image_lib->clear();
Hope that it will be useful.
No comments:
Post a Comment