From 0883e1a6b18311504ddf602b046f5dc19f60e4d7 Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Tue, 3 Aug 2021 13:57:33 +0200 Subject: [PATCH] Add close modal on cliking img Hide link by default --- index.php | 100 +++++++++++++++++++++---------------------- templates/NeoKT.html | 27 +++++++++--- 2 files changed, 69 insertions(+), 58 deletions(-) diff --git a/index.php b/index.php index 9f09b29..4b7cba9 100755 --- a/index.php +++ b/index.php @@ -10,23 +10,23 @@ error_reporting(-1); /** - * Améliore la sortie print - * - * @author Tatane http://www.tatane.info/index.php/print_rn - * @author http://www.blog.cactuscrew.com/77-print_rn.html - * @param $data (array) tableau ou variable à examiner - * @param $name (string) nom a afficher - * @return false affiche les clef valeur du tableau $data - * @example n_print($array, 'Tableau de valeur'); - */ - function n_print($data, $name = '') { + * Améliore la sortie print + * + * @author Tatane http://www.tatane.info/index.php/print_rn + * @author http://www.blog.cactuscrew.com/77-print_rn.html + * @param $data (array) tableau ou variable à examiner + * @param $name (string) nom a afficher + * @return false affiche les clef valeur du tableau $data + * @example n_print($array, 'Tableau de valeur'); + */ +function n_print($data, $name = '') { $aBackTrace = debug_backtrace(); echo '

', $name, '

'; echo '
'; echo '', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], ''; echo '
', htmlentities(print_r($data, 1)), '
'; echo '

'; - } +} // Do not edit below this section unless you know what you are doing! @@ -35,8 +35,8 @@ $version = "0.4.0"; ini_set("memory_limit", "256M"); require "config-default.php"; -if(file_exists('config.php')){ - include "config.php"; +if (file_exists('config.php')) { + include "config.php"; } //----------------------- @@ -62,8 +62,7 @@ if (!function_exists('exif_read_data') && $display_exif == 1) { //----------------------- // FUNCTIONS //----------------------- -function padstring($name, $length) -{ +function padstring($name, $length) { global $label_max_length; if (!isset($length)) { $length = $label_max_length; @@ -74,8 +73,7 @@ function padstring($name, $length) return $name; } -function getfirstImage($dirname) -{ +function getfirstImage($dirname) { $imageName = false; $extensions = array("jpg", "png", "jpeg", "gif", "bmp"); if ($handle = opendir($dirname)) { @@ -98,8 +96,7 @@ function getfirstImage($dirname) return $imageName; } -function parse_fraction($v, $round = 0) -{ +function parse_fraction($v, $round = 0) { list($x, $y) = array_map('intval', explode('/', $v)); if (empty($x) || empty($y)) { return $v; @@ -113,8 +110,7 @@ function parse_fraction($v, $round = 0) return round($x / $y, $round); } -function readEXIF($file) -{ +function readEXIF($file) { $exif_arr = array(); $exif_data = exif_read_data($file); @@ -150,8 +146,7 @@ function readEXIF($file) return $exif_arr; } -function checkpermissions($file) -{ +function checkpermissions($file) { global $messages; if (!is_readable($file)) { @@ -162,13 +157,12 @@ function checkpermissions($file) } } -function guardAgainstDirectoryTraversal($path) -{ +function guardAgainstDirectoryTraversal($path) { $pattern = "/^(.*\/)?(\.\.)(\/.*)?$/"; $directory_traversal = preg_match($pattern, $path); if ($directory_traversal === 1) { - die("ERROR: Could not open " . htmlspecialchars(stripslashes($current_dir)) . " for reading!"); + die("ERROR: Could not open " . htmlspecialchars(stripslashes($path)) . " for reading!"); } } @@ -199,7 +193,7 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) { if (is_readable($caption_filename)) { $caption_handle = fopen($caption_filename, "rb"); while (!feof($caption_handle)) { - $caption_line = fgetss($caption_handle); + $caption_line = fgets($caption_handle); if (empty($caption_line)) { continue; } @@ -320,23 +314,23 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) { $filename_caption = ''; } if (is_file($current_dir . '/' . $file . '.html')) { - $imgComment = $img_captions[$file] = '

'.$file . '

' . htmlspecialchars(file_get_contents($current_dir . '/' . $file . '.html'), ENT_QUOTES); + $imgComment = $img_captions[$file] = '

' . $file . '

' . htmlspecialchars(file_get_contents($current_dir . '/' . $file . '.html'), ENT_QUOTES); } else { - $imgComment = '

'.$file . '

'; + $imgComment = '

' . $file . '

'; } // JPG, GIF and PNG if (preg_match("/.jpg$|.gif$|.bmp$|.png$/i", $file)) { $path_parts = pathinfo($file); - if(file_exists($current_dir.'/'.$path_parts['filename'].'.mp4')){ - $dataVideo = ' data-video="'.$current_dir.'/'.$path_parts['filename'].'.mp4'.'" '; - if (is_file($current_dir.'/'.$path_parts['filename'].'.info.json')) { - $infoContent = json_decode(file_get_contents($current_dir.'/'.$path_parts['filename'].'.info.json')); - $descContent = nl2br(htmlspecialchars('Origin : '.$infoContent->webpage_url.'
Description : '.$infoContent->description)); - $imgComment = $img_captions[$file] = '

'.$file . '

'.$descContent; + if (file_exists($current_dir . '/' . $path_parts['filename'] . '.mp4')) { + $dataVideo = ' data-video="' . $current_dir . '/' . $path_parts['filename'] . '.mp4' . '" '; + if (is_file($current_dir . '/' . $path_parts['filename'] . '.info.json')) { + $infoContent = json_decode(file_get_contents($current_dir . '/' . $path_parts['filename'] . '.info.json')); + $descContent = nl2br(htmlspecialchars('Origin : ' . $infoContent->webpage_url . '
Description : ' . $infoContent->description)); + $imgComment = $img_captions[$file] = '

' . $file . '

' . $descContent; } else { - $imgComment = '

'.$file . '

'; + $imgComment = '

' . $file . '

'; } $videoWithComment = true; } else { @@ -363,7 +357,8 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) { $imgParams = http_build_query( array('filename' => "$thumbdir/$file", 'size' => $thumb_size), '', - '&'); + '&' + ); $imgUrl = GALLERY_ROOT . "createthumb.php?$imgParams"; if ($lazyload) { $imgopts = "class=\"b-lazy\" src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== data-src=\"$imgUrl\""; @@ -377,11 +372,12 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) { "html" => '

- - '.$label_loading.' - '. $filename_caption . ' + + ' . $label_loading . ' + ' . $filename_caption . '

-
'); + ' + ); } // Other filetypes $extension = ""; @@ -418,9 +414,9 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) { } // Excel if (preg_match("/\.ogv$|\.mp4$|\.mpg$|\.mpeg$|\.mov$|\.avi$|\.wmv$|\.flv$|\.webm$/i", $file) && empty($videoWithComment)) { - $extension = "VIDEO"; - } - // video files + $extension = "VIDEO"; + } + // video files if (preg_match("/\.aiff$|\.aif$|\.wma$|\.aac$|\.flac$|\.mp3$|\.ogg$|\.m4a$/i", $file)) { $extension = "AUDIO"; } @@ -433,11 +429,12 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) { "html" => '

- - '.$file.' - '.$filename_caption.' + + ' . $file . ' + ' . $filename_caption . '

-
'); + ' + ); } } } @@ -500,7 +497,7 @@ if ($_GET["page"] == "all" || $lazyload) { if (!$lazyload && $nbDir + $nbFile > $thumbs_pr_page) { for ($i = 1; $i <= ceil(($nbFile + $nbDir) / $thumbs_pr_page); $i++) { if ($_GET["page"] == $i) { - $page_navigation .= ''.$i.''; + $page_navigation .= '' . $i . ''; } else { $page_navigation .= '' . $i . ''; } @@ -508,13 +505,12 @@ if (!$lazyload && $nbDir + $nbFile > $thumbs_pr_page) { if ($i != ceil(($nbFile + $nbDir) / $thumbs_pr_page)) { //$page_navigation .= " | "; } - } //Insert link to view all images if ($_GET["page"] == "all") { $page_navigation .= "$label_all"; } else { - $page_navigation .= ''.$label_all.''; + $page_navigation .= '' . $label_all . ''; } } @@ -581,7 +577,7 @@ if ($i < 0) { } for ($y = $i; $y < $nbFile; $y++) { - if(empty($img_captions[$files[$y]['name']])){ + if (empty($img_captions[$files[$y]['name']])) { $img_captions[$files[$y]['name']] = $files[$y]['name']; } $page_navigation .= ''; diff --git a/templates/NeoKT.html b/templates/NeoKT.html index 9d15548..5d1482f 100644 --- a/templates/NeoKT.html +++ b/templates/NeoKT.html @@ -134,7 +134,7 @@ #modal-content-img img, #video01 video { max-width: 98%; - max-height: 72vh; + max-height: 73vh; padding: 4px; } @@ -145,14 +145,17 @@ box-shadow: 0px 5px rgba(89, 0, 46, 0.5); text-align: left; width: 85vw; - font-size: .9rem; } #comment01 span { - font-size: 1rem; + font-size: .8rem; font-weight: bold; } + .modal-content .w3-theme-d3 ul { + font-size: .9rem; + } + .fas { font-size: 2.5em; } @@ -161,13 +164,17 @@ font-size: 2.5em; font-weight: bolder; text-align: right; - margin: 0; + margin: 0 1rem 0 0; padding: 0; } .closeModal a { text-decoration: none; } + + .toggle { + display: none; + } @@ -199,12 +206,13 @@

X