Example #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;
 }
Example #2
0
    $photolist = $photoApi->getPhotoListBySeq($uid, $albumid, '0_0_0', $num, $next, $next_boundary, 'imageView2/2/w/240');
    $render = new KRender_www();
    if ($loginuid == $uid) {
        $allalbumlist = $photoApi->getAllAlbumList($uid);
        $render->oSetData('allalbumlist', $allalbumlist);
    }
    $render->oSetTemplate('www/photo/album.html')->oSetData('userinfo', $userinfo)->oSetData('albuminfo', $albuminfo)->oSetData('photolist', $photolist)->oSetData('page', array('num' => $num, 'next' => $next, 'next_boundary' => $next_boundary))->oSend();
});
Ko_Web_Route::VGet('item', function () {
    $loginApi = new KUser_loginApi();
    $loginuid = $loginApi->iGetLoginUid();
    $uid = Ko_Web_Request::IGet('uid');
    $photoid = Ko_Web_Request::IGet('photoid');
    $storageApi = new KStorage_Api();
    $photoApi = new KPhoto_Api();
    $photoinfo = $photoApi->getPhotoInfo($uid, $photoid);
    if (empty($photoinfo)) {
        Ko_Web_Response::VSetRedirect('/');
        Ko_Web_Response::VSend();
        exit;
    }
    $photoinfo['image_src'] = $storageApi->sGetUrl($photoinfo['image'], '');
    $photoinfo['image_small'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/1/w/60');
    $photoinfo['image_exif'] = $storageApi->aGetImageExif($photoinfo['image']);
    $agentinfo = KUser_agentApi::get();
    if ($agentinfo['screen']['height'] < 1000) {
        $photoinfo['image'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/2/w/600/h/600');
        $photoinfo['imagesize'] = 600;
    } else {
        $photoinfo['image'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/2/w/800/h/800');
        $photoinfo['imagesize'] = 800;