2012-09-07 87 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这对您有所帮助