public function uploadImage($userfile = 'userfile'){

  //公共部分不作为参数,可变部分作为参数
  /*
  $config['upload_path'] = './uploads/';
  $config['allowed_types'] = 'gif|jpg|png';
  $config['max_size'] = '2000';
  $config['max_width'] = '1024';
  $config['max_height'] = '768';*/
  $config = $this->config->item('upload_p_w_picpath');
  $config['file_name'] = date("YmdHis").rand(100,999);

  $this->load->library('upload', $config);

  $this->upload->initialize($config);
  //参数:$_FILES数组的标签
  if($this->upload->do_upload($userfile)){
   $fileInfo = $this->upload->data();
   $_POST['p_w_picpath'] = $config['upload_path'].$fileInfo['file_name'];
   $this->thumbImage($config['upload_path'].$fileInfo['file_name']);
  }
 }
 public function thumbImage($source_p_w_picpath,$new_p_w_picpath=null){
  $config = $this->config->item('thumb_p_w_picpath');//参数为config数组标签名
  $config['source_p_w_picpath'] = $source_p_w_picpath;
  $config['new_p_w_picpath'] = $config['thumb_path'].$new_p_w_picpath;
  $this->load->library('p_w_picpath_lib', $config);
  $this->p_w_picpath_lib->initialize($config);//以防万一,文档例子不可行时,加上此句
  $this->p_w_picpath_lib->resize();
 }