i have been able to follow this answer and i can actually create multiple image size.
My question is, how can i save each path to a database.
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();
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1PNg7vs
via IFTTT
Aucun commentaire:
Enregistrer un commentaire