Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function uploadFileToS3(Request $request) {
- $image = Image::make($request->file('image'))->encode('jpg', 75);
- $s3 = Storage::disk('s3');
- $image_file_name = $this->generateName($request->name) . '.jpg';
- $file_path = '/' . config('folder') . '/' . $request->page_id . '/' . $request->element_id . '/' . $request->page_to_element_id . '/' . $request->name . '/';
- $s3->put($file_path.'original_'.$image_file_name, $image, 'public');
- $s3->put($file_path.'medium_'.$image_file_name, $image->fit(300, 300), 'public');
- $s3->put($file_path.'thumb_'.$image_file_name, $image->fit(100, 100), 'public');
- return json_encode(array(
- 'filename' => $image_file_name
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement