コード例 #1
0
ファイル: ImgController.php プロジェクト: kurotokiya/Palette
 public function getDetail($pid)
 {
     $image = \Palette\Images::where('id', $pid)->where('uid', Auth::user()->id)->first();
     if (count($image) < 1) {
         session()->flash('error', '没有这张图片或这张图片不属于你');
         return redirect()->back();
     }
     $cdns = \Palette\Cdn::getList();
     return view('img.detail')->withImage($image)->withCdns($cdns);
 }
コード例 #2
0
ファイル: HomeController.php プロジェクト: kurotokiya/Palette
 public function link($file)
 {
     list($uuid, $ext) = explode('.', $file);
     $image = \Palette\Images::where('uuid', $uuid)->where('ext', $ext)->first();
     if (count($image) < 1) {
         header('Content-type: image/png');
         readfile(__DIR__ . '/../../../public/assets/img/default.png');
     }
     header('Content-type: image/' . $ext);
     $imgDir = __DIR__ . '/../../../uploads/' . $image->dir;
     $imgPath = $imgDir . '/' . $image->filename;
     readfile($imgPath);
 }