2012-09-07 86 views
0

我一直在尋找一些教程或一些能夠幫助我解決這個問題的東西,我正在開發一個網站,用戶在其中放置廣告提供房間,當他們放置廣告時,他們可以添加一些照片。我想調整大小並降低照片的質量,這樣他們就不會變大。問題是有時用戶插入奇怪的決議,所以我想要做一些像CSS背景大小:封面屬性。調整照片大小,使較小的一面適合並裁剪其餘部分。用codeigniter調整圖片的尺寸

回答

0

圖片MOO是可以即時完成圖像操作一優庫....

例如,用於調整上傳的圖片到一個特定的路徑,你只需要這樣做

function example_callback_after_upload($uploader_response,$field_info,         $files_to_upload) 
{ 
$this->load->library('image_moo'); 

//Is only one file uploaded so it ok to use it with $uploader_response[0]. 
$file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name; 

$this->image_moo->load($file_uploaded)->resize(800,600)->save($file_uploaded,true); 

return true; 
} 

查看詳情:image moo library 希望這有助於!

0

試試這個: 首先加載圖像庫:

$this->load->library('image_lib'); 

,然後給圖像的配置這樣

$config['width'] = 75; 
$config['height'] = 50; 
$this->load->library('image_lib', $config); 
$this->image_lib->resize();//You can also pass the width,height params through this function 

這是it.may這對您有所幫助