Guest User

Untitled

a guest
Mar 30th, 2016
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. return ($request->all());
  2. ini_set('memory_limit', '-1');
  3. if (!$request-> File('photo')) {
  4. return "Tidak ada photo yang diupload";
  5. } else {
  6. var_dump($request->file('photo'));
  7. }
  8. $photo = $request->file('photo');
  9. //return $photo->getErrorMessage();
  10. $filename = $photo->getClientOriginalName();
  11. $path = public_path() . '/../upload/form';
  12. //$photo->move($path, $filename);
  13.  
  14. $img = Image::make($request->file('photo'));
  15.  
  16. //return "width:". $img->width()." height:".$img->height();
  17. if ($img->width() < $img->height()) {
  18. //return "potrait "."width:". $img->width()." height:".$img->height();
  19. $img->resize(960, 1280);
  20. } elseif ($img->width() > $img->height()) {
  21. //return "landscape "."width:". $img->width()." height:".$img->height();
  22. $img->resize(1280, 960);
  23. }
  24.  
  25. if (!empty(Auth::guard('web')->user()->email)) {
  26. session(["img" => Auth::guard('web')->user()->email . '_' . $filename]);
  27. }
  28. $img->save($path . '/' . Auth::guard('web')->user()->email . '_' . $filename);
  29.  
  30. return "success";
Advertisement
Add Comment
Please, Sign In to add comment