2012-06-05 77 views
1

我的腳本是:笨調整圖像大小

public function resize_image($dir, $new_name, $image, $width, $height) 
{ 
$img_cfg_thumb['image_library'] = 'gd2'; 
$img_cfg_thumb['source_image'] = "./" . $dir . "/" . $image; 
$img_cfg_thumb['maintain_ratio'] = TRUE; 
$img_cfg_thumb['new_image'] = $new_name; 
$img_cfg_thumb['width'] = 200; 
$img_cfg_thumb['height'] = 200; 
$this->load->library('image_lib'); 
$this->image_lib->initialize($img_cfg_thumb); 
$this->image_lib->resize(); 
} 

,但它只是創造200×150

回答

3

什麼尺寸是你的原始圖像的縮略圖?

因爲

$img_cfg_thumb['maintain_ratio'] = TRUE; 

嘗試,並設置爲false

+0

謝謝哥們.. –