From 01cd1848e77ca40758e74f37a62cc1592136aa9f Mon Sep 17 00:00:00 2001 From: Vikram Chand Date: Fri, 15 Mar 2024 15:39:48 +0530 Subject: [PATCH] Updated: intervention image --- Http/Controllers/Backend/MediaController.php | 13 ++++++++++--- Vue/vaahtwo/pages/profile/index.vue | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Http/Controllers/Backend/MediaController.php b/Http/Controllers/Backend/MediaController.php index 3539693c3..817dfb0df 100644 --- a/Http/Controllers/Backend/MediaController.php +++ b/Http/Controllers/Backend/MediaController.php @@ -6,6 +6,8 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\File; use Illuminate\Support\Str; +use Intervention\Image\Drivers\Gd\Driver; +use Intervention\Image\ImageManager; use Symfony\Component\HttpFoundation\BinaryFileResponse; use WebReinvent\VaahCms\Models\Media; @@ -345,6 +347,7 @@ public function upload(Request $request): JsonResponse return response()->json($response); } + try { //add year and month folder if ($request->folder_path == 'public/media') { @@ -402,9 +405,13 @@ public function upload(Request $request): JsonResponse //create thumbnail if image if ($data['type'] == 'image') { - $image = \Image::make($data['full_path'])->fit(180, 101, function ($constraint) { - $constraint->aspectRatio(); - }); + + $manager = new ImageManager( + new Driver() + ); + + $image = $manager->read($data['full_path'])->scale(180, 101); + $name_details = pathinfo($data['full_path']); $thumbnail_name = $name_details['filename'].'-thumbnail.'.$name_details['extension']; $thumbnail_path = $request->folder_path.'/'.$thumbnail_name; diff --git a/Vue/vaahtwo/pages/profile/index.vue b/Vue/vaahtwo/pages/profile/index.vue index 6b586c7cb..86d6fa556 100644 --- a/Vue/vaahtwo/pages/profile/index.vue +++ b/Vue/vaahtwo/pages/profile/index.vue @@ -43,7 +43,7 @@ onMounted(async () => {
@@ -51,7 +51,7 @@ onMounted(async () => {