Last active
October 28, 2015 13:39
-
-
Save RudyJessop/284921fecdbb7c7884bf to your computer and use it in GitHub Desktop.
Saving Images as thumbnails for MVC Projects
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 | |
// For thumbnails | |
$file = $request->file('file'); | |
//Create thubmnail | |
$thmname = time().$file->getClientOriginalName(); // Thumbnail naming | |
$thmfilepath = $filesystem->disk('s3')->put('/tn_/'.$thmname, ''); | |
$image = Image::make($file)->fit(115)->save($thmname); // For Thumbnail image save | |
$file->move($holder, $Imagename); // For original Image save | |
$user->usersPhotos()->create([ | |
'image_thumbnail' => $thmfilepath, | |
'image_name' => $Imagename, | |
]); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment