<?php
$collection = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? [];
-
+$images = [
+ // Images
+ 'jpeg', 'jpg', 'webp', 'gif', 'svg', 'png', 'avif',
+ // Videos
+ 'mp4', 'webm', 'ogv', 'mkv',
+ // Other
+ 'pdf'
+];
+$blank = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==';
?>
@if(isset($entry))
@include('crud::fields.inc.wrapper_start')
@push('crud_fields_scripts')
<?php
+
+
$files = [];
$filesrand = 'files_' . rand(1, 10000);
foreach ($entry->getAllMedia() as $media) {
$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;
}