public function media()
 {
     $Media = new Media();
     $res = $Media->upload("http://static.cnbetacdn.com/slide/2014/1022/1413990687.jpg", "image");
     dump($res);
     $res = $Media->download($res['media_id']);
     dump($res);
 }
 public function picAddHandle()
 {
     $config = array("savePath" => 'Weixin/', "maxSize" => 1000000, "exts" => array('jpg', 'jpeg'), "subName" => array('date', 'Y/m-d'));
     $upload = new Upload($config);
     $info = $upload->upload();
     if (!$info) {
         // 上传错误提示错误信息
         $this->error($upload->getError());
     } else {
         // 上传成功 获取上传文件信息
         //   $file_path_full = Upload_PATH . $info['img']['savepath'] . $info['img']['savename'];
         $file_path_full = $info['img']['fullpath'];
         if (!defined('SAE_TMP_PATH')) {
             // 非SAE环境中
             $image = new \Think\Image();
             $image->open($file_path_full);
             $image->thumb(150, 150)->save($file_path_full);
             $img_url = "http://" . $_SERVER['SERVER_NAME'] . str_replace('index.php', '', __APP__) . $file_path_full;
         } else {
             // SAE环境中
             $img_url = $file_path_full;
         }
         $Media = new Media();
         $res = $Media->upload($file_path_full, "image");
         $data['type'] = $res['type'];
         $data['mediaId'] = $res['media_id'];
         $data['picurl'] = $img_url;
         $res = D('Weixinre')->data($data)->add();
         if ($res) {
             $this->success('上传成功!', U('Weixin/Reply/index'));
         }
     }
 }