Laravel干预图像不起作用

时间:2015-01-14 01:44:34

标签: php laravel

我通过作曲家从Intervention Image教程安装了Laravel this类,当我输入作曲家更新时,作曲家返回:

D:\WEB\htdocs\zanbil>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing intervention/image (dev-master b91b0d6)
    Downloading: 100%
    Downloading: 100%

intervention/image suggests installing intervention/imagecache (Caching extension for the Intervention Image library)
intervention/image suggests installing ext-imagick (to use Imagick based image processing.)
Writing lock file
Generating autoload files
Generating optimized class loader

这就是我将要使用干预图像

$image=Input::file('image');
        $name = Input::file('image')->getClientOriginalName();
        var_dump(Image::make($image->getRealPath()->resize('280','280')->save('public/up/city/'.$name)));

当我运行该代码时,Laravel返回(使用浏览器):

  

Symfony \ Component \ Debug \ Exception \ FatalErrorException(E_ERROR)   在非对象上调用成员函数resize()

问题是什么?

1 个答案:

答案 0 :(得分:3)

您对 getRealPath()的结果调用调整大小。我想你想做这样的事情:

Image::make($image->getRealPath())->resize('280', '280')->save('public/up/city/'.$name)

感谢lukasgeiter的回答