我遇到了这个错误信息:
Call to undefined function Intervention\\Image\\Gd\\imagecreatefromjpeg()
这是我的PHP信息:
我正在使用Laravel框架(版本5.6)和PHP 7.1。
我想要上传一张图片,但是出现了这个错误。
gd
GD Support enabled
GD Version bundled (2.1.0 compatible)
GIF Read Support enabled
GIF Create Support enabled
PNG Support enabled
libPNG Version 1.6.32
WBMP Support enabled
XBM Support
我的存储函数:
public function store(CompanyRequest $request)
{
$all = $request->except(['category-company', 'flag', 'null', 'file', 'producer-company','manager','address','description','phone']);
$flag = array_values($request->input('flag'));
$jsonFlag = json_encode($flag);
$all['flag'] = $jsonFlag;
if($request->input('manager')){
$all['manager']=$request->input('manager');
}
if($request->input('address')){
$all['address']=$request->input('address');
}
if($request->input('description')){
$all['description']=$request->input('description');
}
if($request->input('phone')){
$all['phone']=$request->input('phone');
}
$file = $request->file('file');
$name = $file->getClientOriginalName();
$dir = '/img/company/';
$path = $dir . time() . $name;
$thumbnail = $dir . 'tn-' . time() . $name;
$all['path'] = $path;
$all['thumbnail'] = $thumbnail;
$company = Company::create($all);
$file->move('img/company', time() . $name);
$img = Image::make('img/company/' . time() . $name);
$img->resize(100, 100);
$img->save('img/company/tn-' . time() . $name);
$company->categories()->sync($request->input('category-company'));
$company->producers()->sync($request->input('producer-company'));
return Response::json($company);
}