【发布时间】:2021-01-22 03:10:08
【问题描述】:
我需要将使用base64转换的图像保存到存储目录,而不是将其保存在public文件夹中,
这是我的存储功能,它将图像保存到我的public 目录中,
public function store(Request $request, Category $category)
{
if ($request->image) {
$name = time().'.'. explode('/', explode(':',substr($request->image, 0, strpos($request->image, ';')))[1])[1];
Image::make($request->image)->save(public_path('img/category/').$name);
return response('success');
}
我需要知道如何将图像保存到我的存储文件夹中,
【问题讨论】:
-
你运行了 php artisan storage:link 吗?
-
@TariqImtinan 是的,我做了,我需要知道如何编写将数据保存到存储目录的函数,上面的代码将文件保存到 public/img/category 目录
标签: php laravel base64 laravel-7 intervention