From 8d5464183af093e5d55af6a2ef9a0b9e0d89ae10 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 28 Feb 2022 20:35:00 +0100 Subject: [PATCH] wait #5127 @0.5 --- .../views/fields/dropzone_media.blade.php | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/resources/views/fields/dropzone_media.blade.php b/src/resources/views/fields/dropzone_media.blade.php index 768f07a..0d072ea 100644 --- a/src/resources/views/fields/dropzone_media.blade.php +++ b/src/resources/views/fields/dropzone_media.blade.php @@ -1,6 +1,14 @@ @if(isset($entry)) @include('crud::fields.inc.wrapper_start') @@ -152,6 +160,8 @@ $collection = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? @push('crud_fields_scripts') getAllMedia() as $media) { @@ -169,10 +179,18 @@ $collection = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $full = ''; } - try { - $thumb_url = $media->getUrl($field['thumb_conversion'] ?? null); - } catch (Exception $e) { - $thumb_url = ''; + $e = explode('.', $full); + $ext = mb_strtolower(array_pop($e)); + + if (in_array($ext, $images)) { + try { + $thumb_url = $media->getUrl($field['thumb_conversion'] ?? null); + } catch (Exception $e) { + + } + } + if (!isset($thumb_url)) { + $thumb_url = $blank; } -- 2.39.5