Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- return ($request->all());
- ini_set('memory_limit', '-1');
- if (!$request-> File('photo')) {
- return "Tidak ada photo yang diupload";
- } else {
- var_dump($request->file('photo'));
- }
- $photo = $request->file('photo');
- //return $photo->getErrorMessage();
- $filename = $photo->getClientOriginalName();
- $path = public_path() . '/../upload/form';
- //$photo->move($path, $filename);
- $img = Image::make($request->file('photo'));
- //return "width:". $img->width()." height:".$img->height();
- if ($img->width() < $img->height()) {
- //return "potrait "."width:". $img->width()." height:".$img->height();
- $img->resize(960, 1280);
- } elseif ($img->width() > $img->height()) {
- //return "landscape "."width:". $img->width()." height:".$img->height();
- $img->resize(1280, 960);
- }
- if (!empty(Auth::guard('web')->user()->email)) {
- session(["img" => Auth::guard('web')->user()->email . '_' . $filename]);
- }
- $img->save($path . '/' . Auth::guard('web')->user()->email . '_' . $filename);
- return "success";
Advertisement
Add Comment
Please, Sign In to add comment