我已经能够遵循这个答案,我实际上可以创建多个图像大小。
我的问题是,如何将每个路径保存到数据库。
public function store(Request $request)
{
$input= $request->all();
$file = $input['image'];
$destinationPath='images/products';
$destinationPathlarge='images/products/large';
$extension = $file->getClientOriginalExtension();
$fileName = rand(111,999).'.'.$extension;
$image = $destinationPath . '/' .$fileName;
$upload_success= $file-> move($destinationPath,$fileName);
$doc = new Products();
$doc->name = $input['name'];
$doc->price = $input['price'];
$doc->description = $input['description'];
$doc->s_description = $input['s_description'];
$doc->brands_id = $input['brands_id'];
$doc->categories_id = $input['categories_id'];
$upload = Image::make($image)->resize(190,185)->save($destinationPath. '/' .$fileName)
->resize(100,100)->save($destinationPathlarge. '/'.$fileName);
$doc->save();