[英]Laravel Intervention Image not working
在本教程中,我通过作曲家安装了Laravel Intervention Image类,当我输入作曲家更新时,作曲家返回:
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
这就是我将要与Intervention Image一起使用的内容:
$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 \\组件\\调试\\异常\\ FatalErrorException(E_ERROR)在非对象上调用成员函数resize()
您对getRealPath()的结果调用resize 。 我认为您想改为执行以下操作:
Image::make($image->getRealPath())->resize('280', '280')->save('public/up/city/'.$name)
感谢lukasgeiter的回答
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.