在Laravel 5.7中,命令(存储)不适用于驱动程序(Gd)干预映像

时间:2019-01-10 04:53:14

标签: laravel

我使用干预图像Laravel ... laravel 5.7和PHP 7.2

当我调整图像大小并保存到数据库时,会出现这样的错误

Command (Store) is not available for driver (Gd).

这是我的控制器

  public function store(Request $request)
{
    $request->validate([
        'tittle' => 'required|string|unique:banners|max:255'
    ],[
        'tittle.required' => 'Tittle sudah ada',
     ]);
    $data = $request->all();
    $file= Image::make($request->file('file'))->store('uploads/file','public');
    $path= $file->resize(150,150);
    $this->repo->create([$data,$path]);
    return redirect()->route('banner.index')->with('alert', ['type' => 'success', 'message' => 'Data inserted successfully']);
}

我一直遵循文档说明

 php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"

但出现上述错误...帮助 谢谢

1 个答案:

答案 0 :(得分:0)

可能是

$path = $request->file('file')->store('uploads/file', 'public');
Image::make(storage_path($path))->resize(150,150)->save();