|
本帖最后由 106185050 于 2010-3-9 11:46 编辑
以下是image_lib处理函数
// --------------------------------------------------------------------
/**
* 生成缩略图
* @param string ($path 图片路径)
* @return array
* @access public
*/
function thumbImg($path,$width,$height,$ext){
$config['image_library'] = 'gd';
$config['source_image'] = $path;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['master_dim'] = 'height';
$config['quality'] = 100;
$config['thumb_marker'] = $ext;
$config['width'] = $width;
$config['height'] = $height;
$this->load->library('image_lib');
$this->image_lib->initialize($config);
if ( ! $this->image_lib->resize()){
die($this->image_lib->display_errors());
}
$this->image_lib->clear();
}
$this->thumbImg($imgPath,100,140,'_140');
可以按比例生成图片。可是缩略生成的图片却失真十分严重,请教如何处理呵!~!~!~ |
|