]> _ Git - cubist_cms-back.git/commitdiff
wip #3531
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 30 Mar 2020 16:42:58 +0000 (18:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 30 Mar 2020 16:42:58 +0000 (18:42 +0200)
src/resources/views/fields/dropzone_media.blade.php

index bd33cedd2e013332f88e69c5f21fb48aba2b9e88..8ff0d0b80995780ce2f3f6ea9e871e760e31f003 100644 (file)
@@ -101,7 +101,7 @@ $collection = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ??
                     height: 26px;
                     border-radius: 3px 3px 0 0;
                     background: #b50005;
-                    z-index:21;
+                    z-index: 21;
                     cursor: pointer;
                 }
 
@@ -159,13 +159,30 @@ $collection = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ??
                 if (!isset($files[$collection])) {
                     $files[$collection] = [];
                 }
+
+                $full = null;
+                $thumb_url = null;
+
+                try {
+                    $full = $media->getUrl();
+                } catch (Exception $e) {
+                    $full = '';
+                }
+
+                try {
+                    $thumb_url = $media->getUrl($field['thumb_collection'] ?? '');
+                } catch (Exception $e) {
+                    $thumb_url = '';
+                }
+
+
                 $files[$collection][] = [
                     'id' => $media->id,
                     'order_column' => $media->order_column,
                     'size' => $media->size,
                     'name' => $media->file_name,
-                    'full_url' => $media->getUrl(),
-                    'thumb_url' => $media->getUrl($field['thumb_collection'] ?? ''),
+                    'full_url' => $full,
+                    'thumb_url' => $thumb_url
                 ];
             }