public function getAvatarAttribute() { if (isset($this->attributes['avatar']) && $this->attributes['avatar'] != '') { $image = QiniuUtil::buildQiqiuImageUrl($this->attributes['avatar']); return $image; } else { return $this->attributes['avatar']; } }
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); }
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; }
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; }