From 14673975efb6810021cef6de9f5ec5629859a7d1 Mon Sep 17 00:00:00 2001 From: "afiq.hamzah" Date: Mon, 5 Dec 2022 15:29:10 +0800 Subject: [PATCH] Improve load time of marhun page --- app/Services/MarhunPhotoService.php | 16 ++++++++-------- resources/views/marhun/marhun.blade.php | 7 ++++--- .../marhun/partials/camera_modals.blade.php | 4 ++-- .../partials/camera_modals_per_marhun.blade.php | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/Services/MarhunPhotoService.php b/app/Services/MarhunPhotoService.php index 649bcb76..619a2f80 100644 --- a/app/Services/MarhunPhotoService.php +++ b/app/Services/MarhunPhotoService.php @@ -129,23 +129,23 @@ class MarhunPhotoService $cwebp_compilers = [ 'Windows' => 'binaries\libwebp-1.2.4-windows-x64\bin\cwebp', 'Linux' => 'binaries\libwebp-1.2.4-linux-x86-64\bin\cwebp', - ]; - - $cwebp_compilers_darwin = [ - 'X86-64' => 'binaries\libwebp-1.2.4-mac-X86-64\bin\cwebp', - 'arm64' => 'binaries\libwebp-1.2.4-mac-arm64\bin\cwebp', + 'Darwin' => [ + 'X86-64' => 'binaries\libwebp-1.2.4-mac-X86-64\bin\cwebp', + 'arm64' => 'binaries\libwebp-1.2.4-mac-arm64\bin\cwebp', + ], ]; $server_operating_system = explode(' ', trim(php_uname()))[0]; $server_processor_architecture = trim(php_uname('m')); + if ($server_operating_system === 'Darwin') { + return resource_path($cwebp_compilers['Darwin'][$server_processor_architecture]); + } + if (in_array($server_operating_system, array_keys($cwebp_compilers))) { return resource_path($cwebp_compilers[$server_operating_system]); } - if ($server_operating_system === 'Darwin') { - return resource_path($cwebp_compilers_darwin[$server_processor_architecture]); - } } private function optimizeImageToWebP($originalFilePath, $directory, $lelongbidmarhun_id) diff --git a/resources/views/marhun/marhun.blade.php b/resources/views/marhun/marhun.blade.php index ab21b8fc..142ad8ed 100644 --- a/resources/views/marhun/marhun.blade.php +++ b/resources/views/marhun/marhun.blade.php @@ -16,11 +16,12 @@ @endpush -@include('marhun.partials.camera_modals_per_marhun') -@include('marhun.partials.camera_modals') - @section('content')
+ + @include('marhun.partials.camera_modals_per_marhun') + @include('marhun.partials.camera_modals') +
diff --git a/resources/views/marhun/partials/camera_modals.blade.php b/resources/views/marhun/partials/camera_modals.blade.php index ff6e6a6d..2517605d 100644 --- a/resources/views/marhun/partials/camera_modals.blade.php +++ b/resources/views/marhun/partials/camera_modals.blade.php @@ -19,7 +19,7 @@
@@ -77,7 +77,7 @@
diff --git a/resources/views/marhun/partials/camera_modals_per_marhun.blade.php b/resources/views/marhun/partials/camera_modals_per_marhun.blade.php index 65a91afa..534afe87 100644 --- a/resources/views/marhun/partials/camera_modals_per_marhun.blade.php +++ b/resources/views/marhun/partials/camera_modals_per_marhun.blade.php @@ -21,7 +21,7 @@
@@ -77,7 +77,7 @@