/** * 剪裁头像 */ public function facecrop(){ $sourcefilename = $this -> input -> post('crop_filename'); $sourcepath = UPLOADPATH.'/images/day_'.date('ymd').'/'.$sourcefilename; $x = $this -> input -> post('x'); $y = $this -> input -> post('y'); $w = $this -> input -> post('w'); $h = $this -> input -> post('h'); $config['image_library'] = 'gd2'; $config['x_axis'] = $x; $config['y_axis'] = $y; $config['width'] = $w; $config['height'] = $h; $config['source_image'] = $sourcepath; $config['maintain_ratio'] = false; $this->load->library('Image_lib', $config); $r = $this->image_lib->crop(); echo $r; }