【问题标题】:Command (Store) is not available for driver (Gd) intervention image in Laravel 5.7Laravel 5.7 中的驱动程序(Gd)干预图像无法使用命令(存储)
【发布时间】:2019-01-10 04:53:13
【问题描述】:

我使用干预图像 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"

,,

但是上面的错误...帮助 谢谢

【问题讨论】:

  • 你试过save而不是store
  • store() 方法需要一个文件对象而不是图像。

标签: laravel


【解决方案1】:

可能

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

【讨论】:

    猜你喜欢
    • 2021-02-13
    • 1970-01-01
    • 2017-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多