【发布时间】:2017-04-13 16:26:26
【问题描述】:
我使用laravelFilesystem存储图片,图片会上传到默认存储里面,例如:
/home/user/Projects/mywebapp/storage/app/images/posts/1/e392e17926559e7cc4e7934f.png
我没有更改config/filesystem.php,这是我上传图片的控制器方法,
public function storeImage( Request $request ) {
$image = $request->file( 'image' )->store( 'images/posts/'.Auth::user()->id );
echo Storage::url( $image ); // <- print the url of the uploaded image
}
这将像这样打印图像网址,
http://localhost:8000/storage/images/posts/1/e392e17c6a8d7926559e8e7cc4e7934f.png
但是无法从浏览器访问图像文件! 我不想使用 php 来动态获取图像,我只是想让它们通过 http 公开访问。如何显示图片?
【问题讨论】:
标签: php laravel laravel-5.3 php-7