Created
June 26, 2017 09:39
-
-
Save vimalmistry/7f976399124a65c856f17ce8ec407924 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function fileUploadAndResize(Request $request, $user) | |
{ | |
ini_set('memory_limit', '256M'); | |
if ($request->file('image')) { | |
$image = $request->file('image'); | |
$filename = uniqid($user->id) . '.' . $image->getClientOriginalExtension(); | |
$path = public_path('images') . '/' . $filename; | |
\Image::make($image->getRealPath()) | |
->resize(200, 200) | |
->save($path); | |
return $filename; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment