From eb56f4669335b6c98713a37644902d3ef4549678 Mon Sep 17 00:00:00 2001 From: Claudio-Emmolo <113107618+Claudio-Emmolo@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:36:50 +0200 Subject: [PATCH] [photo] shortcode, fix order images --- resources/views/new-gallery.blade.php | 2 +- src/Shortcodes/PhotoShortcode.php | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/resources/views/new-gallery.blade.php b/resources/views/new-gallery.blade.php index ea5be84..b875823 100644 --- a/resources/views/new-gallery.blade.php +++ b/resources/views/new-gallery.blade.php @@ -1,7 +1,7 @@
- @foreach (json_decode($images) as $image) + @foreach ($images as $image) @if ($loop->iteration <= 5) link) : null; $shape = $shortcode->shape ?? null; @@ -58,7 +64,7 @@ public function register($shortcode): string if (is_array($credits)) { $credits = $credits[0]; } - $alt = $media->data['alt'] ?? 'Immagine id '.$shortcode->id; + $alt = $media->data['alt'] ?? 'Immagine id ' . $shortcode->id; if (is_array($alt)) { $alt = $alt[0]; } @@ -87,10 +93,10 @@ public function register($shortcode): string public static function getImageHeight(string $path, int $width = 0): float|int { - $localPath = storage_path('app/public/'.$path); + $localPath = storage_path('app/public/' . $path); // Check if file exists - if (! file_exists($localPath)) { + if (!file_exists($localPath)) { return 0; }