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); }
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); }