Пример #1
0
 public function post($update, $after = null, $post_style = 'default')
 {
     $file = Ko_Web_Request::AFile('file');
     $api = new KStorage_Api();
     if (!$api->bUpload2Storage($file, $image)) {
         throw new Exception('文件上传失败', 1);
     }
     $title = $file['name'];
     $loginApi = new KUser_loginApi();
     $uid = $loginApi->iGetLoginUid();
     $photoApi = new KPhoto_Api();
     switch ($post_style) {
         case 'album':
             $albumid = $update;
             break;
         default:
             $albumid = 0;
             break;
     }
     $photoid = $photoApi->addPhoto($albumid, $uid, $image, $title);
     $this->_sendSysmsg($uid, $albumid, $photoid);
     $data = array('key' => compact('uid', 'photoid'));
     if (is_array($after)) {
         switch ($after['style']) {
             default:
                 $data['after'] = $photoApi->getPhotoInfo($uid, $photoid);
                 $data['after']['image'] = $api->sGetUrl($image, $after['decorate']);
                 break;
         }
     }
     return $data;
 }
Пример #2
0
 public function post($update, $after = null)
 {
     $file = Ko_Web_Request::AFile('file');
     $api = new KStorage_Api();
     if (!$api->bUpload2Storage($file, $sDest)) {
         throw new Exception('文件上传失败', 1);
     }
     $data = array('key' => $sDest);
     if (is_array($after)) {
         switch ($after['style']) {
             default:
                 $data['after'] = $api->sGetUrl($sDest, $after['decorate']);
                 break;
         }
     }
     return $data;
 }