Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel 5.4和对未定义方法Illumb\Database\Query\Builder::Image()的干预图像调用_Php_Laravel - Fatal编程技术网

Php Laravel 5.4和对未定义方法Illumb\Database\Query\Builder::Image()的干预图像调用

Php Laravel 5.4和对未定义方法Illumb\Database\Query\Builder::Image()的干预图像调用,php,laravel,Php,Laravel,我正在使用Intervention Image()包,并使用它的Laravel集成。如文件所述,我已向服务提供商添加以下内容: Intervention\Image\ImageServiceProvider::class 并将以下别名添加到立面 'Image' => Intervention\Image\Facades\Image::class 在我的控制器中,我正在执行文档中所述的操作: // Create a thumbnail for the image $thu

我正在使用Intervention Image()包,并使用它的Laravel集成。如文件所述,我已向服务提供商添加以下内容:

Intervention\Image\ImageServiceProvider::class
并将以下别名添加到立面

'Image' => Intervention\Image\Facades\Image::class
在我的控制器中,我正在执行文档中所述的操作:

    // Create a thumbnail for the image
    $thumb = Image::make('images/' . $date . "/" . $request->file->hashName());
    $thumb->resize(320, 240);
    $thumb->save('images/' . $date . "/thumb_" . $request->file->hashName());
但我得到了一个错误:

ErrorException: Call to undefined method Illuminate\Database\Query\Builder::image() 
编辑:

类名中可能存在冲突?我也有一个叫做Image的模型,所以我认为它可能与此有关

    // Save the image details to the database
    $image = new Image;
    $image->filename = $request->file->hashName();
    $image->path = 'images/' . $date;
    $image->album_id = $request->id;
    $image->save();

    // Create a thumbnail for the image
    $thumb = Image::make('images/' . $date . "/" . $request->file->hashName());
    $thumb->resize(320, 240);
    $thumb->save('images/' . $date . "/thumb_" . $request->file->hashName());

是的,这是一个类名冲突。您可以使用以下选项:

$thumb=\Intervention\Image\Facades\Image::make('images/'.$date./'$request->file->hashName())

删除
使用图像
使用干预\Image\Facades\Image在您的代码中