I have a small problem concerning the resizing process of a given image, I am trying to submit a form containing an input type -->file<-- I was able to upload a picture witho
In L5.2
its not directly possible to get image from Input
facade. For that we need to first store the image on server and then give path into Image
facade to do operations on image.
Code goes likes this:
if ($request->hasFile('picture') ) {
$destinationPath = public_path('uploads/user');
$photoname = date("YmdHis");
$file_extention = '.'.$request->file('picture')->getClientOriginalExtension();
$photo = $photoname.$file_extention;
$file_check = $request->file('picture')->move($destinationPath, $photo);
$thumb_path = $destinationPath.'/thumbnail/'.$photo;
$new_filePath = $destinationPath.'/'.$photo;
$assets_path = url('uploads/user/');
$img = Image::make($assets_path.'/'.$photo)->fit(100)->save($thumb_path,40);
$data['picture'] = $photo;
}
I was looking for direct solution i.e. as it was possible previously to take image directly from Input
facade. If anyone of you have direct solution, show your code here and I'll reward you this bounty. Cheers.