示例#1
0
文件: User.php 项目: loopeer/quickcms
 public function getAvatarAttribute()
 {
     if (isset($this->attributes['avatar']) && $this->attributes['avatar'] != '') {
         $image = QiniuUtil::buildQiqiuImageUrl($this->attributes['avatar']);
         return $image;
     } else {
         return $this->attributes['avatar'];
     }
 }
示例#2
0
 public function getAvatarAttribute($value)
 {
     if (is_null($value) || $value == '') {
         return null;
     }
     $images = explode(',', $value);
     foreach ($images as $key => $image) {
         if (stripos($image, 'http:') === FALSE) {
             $images[$key] = QiniuUtil::buildQiqiuImageUrl($image);
         }
     }
     return implode(',', $images);
 }
示例#3
0
 public function getImageAttribute($value)
 {
     $images = null;
     if (isset($va) && $va != '') {
         $qn_images = array();
         $images = explode(',', $value);
         if (count($images) > 1) {
             foreach ($images as $image) {
                 $image = QiniuUtil::buildQiqiuImageUrl($image);
                 array_push($qn_images, $image);
             }
             return $qn_images;
         } else {
             return QiniuUtil::buildQiqiuImageUrl($value);
         }
     }
     return $images;
 }
示例#4
0
 public function fileList($id)
 {
     $table = Input::get('table');
     $column = Input::get('column');
     $row = DB::table($table)->find($id);
     $keys = !empty($row->{$column}) ? explode(',', $row->{$column}) : null;
     $files = array();
     if (isset($keys)) {
         foreach ($keys as $key) {
             $url = QiniuUtil::buildQiqiuImageUrl($key);
             $file_info = json_decode(file_get_contents($url . '?stat'));
             $size = $file_info->fsize;
             $mime_type = $file_info->mimeType;
             $upload_key = strstr($key, '.', true);
             $files[] = ['name' => $key, 'size' => $size, 'key' => $upload_key, 'url' => $url, 'mime_type' => $mime_type, 'real_key' => $key];
         }
     }
     return $files;
 }