I have this controller and trying to post image into /images folder so I write:
public function store(Requests\VoucherRequest $request)
{
//$photo= null;
$file = array('photo' => $request->file('photo'));
// setting up rules
$rules = array('photo' => 'required|image|max:10000'); //mimes:jpeg,bmp,png and for max size max:10000
// doing the validation, passing post data, rules and the messages
$validator = Validator::make($file, $rules);
if ($validator->fails()) {
// send back to the page with the input data and errors
return redirect()->back()->withErrors(["photo" => "Photo requirments - format: jpg, jpeg, png | max. size: 1 MB"]);
}
else {
// checking file is valid.
if ($request->file('photo')->isValid()) {
$destinationPath = public_path().'/images'; // upload path
$extension = $request->file('photo')->getClientOriginalExtension();
// getting image extension
$ran = str_random(5);
$photo = $ran.'.'.$extension; // renameing image
$request->file('photo')->move($destinationPath, $photo);
Image::make($request->file('photo'))->resize(300, 200)->save('images/'.$ran.'ORG.'.$extension);
}
else {
return redirect()->back()->withErrors(["photo" => "Photo requirments - format: jpg, jpeg, png | max. size: 1 MB"]);
}
}
but now i get only:
NotReadableException in Decoder.php line 20:
Unable to read image from file ().
WHat is a problem here? WHy I cant get and rezise image ... everything else works just Image Intevention dont work...