【发布时间】:2016-04-21 20:22:42
【问题描述】:
我在控制器中编写了以下方法,该方法遍历文件夹中的所有文件并返回这些文件:
$files = Storage::files($gallery);
public function showGallery($gallery)
{
$gallery = base64_decode($gallery);
$gallery_name = explode('/', $gallery);
$directories = Storage::directories($gallery);
$galleries = $gallery_name;
unset($galleries[0]);
unset($galleries[1]);
array_pop($galleries);
$files = Storage::files($gallery);
$locations = array();
foreach ($files as $file)
{
if($this->is_image($file))
{
$locations[] = Image::make(storage_path('app/' . $file))->encode( 'data-url' );
} else
{
$locations[] = storage_path('app/' . $file);
}
}
//dd($locations);
$data = [
'directories' => $directories,
'galleries' => $galleries,
'gallery_path' => $gallery,
'gallery_name' => end($gallery_name),
'locations' => $locations,
];
return view('private.user.gallery', $data);
}
在此之后,我将图像与其他文件类型分开。
我正在使用干预图像库使图像公开可用和可见。
但是在显示其他文件(如图标)时,例如 PDF、doc、mov 文件,我卡住了。
当我点击前端中的这些图标时,我会收到此错误。
链接: http://lamotte.local/home/vagrant/projects/lamotte/storage/app/gallery/Brand/pdf-test.pdf
RouteCollection.php 第 161 行中的 NotFoundHttpException:
存储这些文件的原因是因为这些文件需要通过登录系统进行访问控制。
有没有可以处理这个的库?
【问题讨论】: