예제 #1
0
파일: avatar.php 프로젝트: momoim/momo-api
 public function sendfacefeed($pid, $album_id = 0, $img = "", $appid = 0)
 {
     $return = false;
     if ($pid) {
         $feed_flag = 1;
         if ($feed_flag == 1) {
             //发送好友动态
             $data = $this->db->getRow("album_pic", "pic_width, pic_height", "pic_id={$pid}");
             if ($data['pic_height'] >= 780 || $data['pic_width'] >= 780) {
                 if ($height >= $width) {
                     $height_780 = 780;
                     $width_780 = intval($data['pic_width'] / ($data['pic_height'] / 780));
                 } else {
                     $width_780 = 780;
                     $height_780 = intval($data['pic_height'] / ($data['pic_width'] / 780));
                 }
             } else {
                 $height_780 = $data['pic_height'];
                 $width_780 = $data['pic_width'];
             }
             $this->feed = new Feed_Model();
             if (!$img) {
                 $img = Kohana::config('album.recordThumb') . 'thumb/' . $pid . '_120.jpg';
             }
             $realname = sns::getrealname($this->uid);
             $feedkey = sns::getFeedUniqid('user_face_update');
             $feed = array('title' => array('uid' => $this->uid, 'name' => sns::getrealname($this->uid), 'time' => time(), 'appid' => $appid), 'body' => array('uid' => $this->uid, 'image' => $img, 'name' => $realname, 'pid' => $pid, 'img_780' => Kohana::config('album.recordThumb') . 'thumb/' . $pid . '_780.jpg', 'aid' => $album_id, 'height_780' => $height_780, 'width_780' => $width_780));
             $result = $this->feed->addFeed($this->uid, 'user_face_update', Kohana::config('uap.app.user'), $feed['title'], $feed['body'], $feedkey, '', '', array(), $appid);
             $return = $result['code'] == 200 ? true : false;
         }
     }
     return $return;
 }