diff --git a/css/style.css b/css/style.css index d794a05..cd88985 100644 --- a/css/style.css +++ b/css/style.css @@ -230,6 +230,18 @@ input[type=checkbox]{ height: 100%; } +.content-single .single-video { + object-fit: contain; + grid-column: 1 / 4; + grid-row: 1 / 2; +} + +.content-single .single-video video { + width: 100%; + height: auto; + max-height: 100%; +} + /* Clickable Areas in Single Image View */ .content-single .clickable { position: relative; diff --git a/img/video.jpg b/img/video.jpg new file mode 100644 index 0000000..cc7980a Binary files /dev/null and b/img/video.jpg differ diff --git a/img/video.png b/img/video.png new file mode 100644 index 0000000..d528ddc Binary files /dev/null and b/img/video.png differ diff --git a/index.php b/index.php index 9982dd6..4f8bd91 100644 --- a/index.php +++ b/index.php @@ -73,7 +73,7 @@ if (isset($_SESSION[$cdir]) $rmdirs[] = '..'; $files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), $rmdirs); // Filter Unsupported Files - $files = array_values(preg_grep('/.*\.(?!(webm|sh)).*/i', $files)); + $files = array_values(preg_grep('/.*\.(?!(db|sh)).*/i', $files)); $_SESSION[$cdir]['f'] = isset($files) ? $files : null; $_SESSION[$cdir]['d'] = isset($dirs) ? $dirs : null; $_SESSION[$cdir]['t'] = time(); @@ -162,6 +162,7 @@ if (!empty($curfiles)| !empty($dirs)) { foreach ($curfiles as $index => $image) { $data['imageurl'] = str_replace("'", "'", $imageurl.$dir.'/'.$image); $data['imagename'] = $image; + $data['filetype'] = mime_content_type(Helpers::end_dir($imagedir.$dir).$image); $data['tags'] = array_filter(explode(" ", pathinfo(trim(strstr(strtolower($image), ' - '), " -"))['filename'])); } Template::view('tpl/single.html', $data); diff --git a/lib/thumbs.class.php b/lib/thumbs.class.php index 3d58258..c0ec3fd 100644 --- a/lib/thumbs.class.php +++ b/lib/thumbs.class.php @@ -37,6 +37,12 @@ class thumb { $dstpath = $this->thumbdir.$dstname.'.jpg'; if (!file_exists($dstpath)) { + + if(str_starts_with(mime_content_type($src), 'video/')) { + error_log("$src: Video File"); + return "img/video.png"; + } + $type = exif_imagetype($src); if ($type == 0) { error_log("$src: Unknown Image Type"); diff --git a/tpl/single.html b/tpl/single.html index b926d22..125bf85 100644 --- a/tpl/single.html +++ b/tpl/single.html @@ -10,9 +10,17 @@ {% else: %}
{% endif %} + {% if(str_starts_with($filetype, 'video/')): %} +
+ +
+ {% else: %}
+ {% endif %} {% if ($page > 1): %}