From af6d0d8338feb668e14f6a09a42cc6e678150675 Mon Sep 17 00:00:00 2001 From: Junior Date: Fri, 4 Sep 2026 11:51:21 -0400 Subject: [PATCH] Improve issue name display when name is very long and has a hypen --- ajax/getfoldercontents.php | 14 ++++++++++++-- config-dist.php | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ajax/getfoldercontents.php b/ajax/getfoldercontents.php index d2dde62..ba29a90 100644 --- a/ajax/getfoldercontents.php +++ b/ajax/getfoldercontents.php @@ -77,10 +77,20 @@ foreach ( $entries as $entry ) { $folders[] = $info; } else { if ( (substr($entry, -3) == "cbz") || (substr($entry, -3) == "cbr") ) { - $info["comname"] = substr(((strpos($entry, " - ") !== false) ? str_replace(" - ", "
", $entry) : $entry), 0, -4); + $withoutext = substr($entry, 0, -4); + if ( strlen($withoutext) <= ISSUELENGTHCUTOFF ) { + $info["comname"] = str_replace(" - ", "
", $withoutext); + } else { + if ( strpos($withoutext, " - ") !== false ) { + $info["comname"] = substr($withoutext, strpos($withoutext, " - ") + 3); + } else { + $info["comname"] = $withoutext; + } + } + //$info["comname"] = substr(((strpos($entry, " - ") !== false) ? str_replace(" - ", "
", $entry) : $entry), 0, -4); $info["relcomic"] = base64_encode($compath . (($compath == "/") ? "" : "/") . $entry); $info["mtime"] = filemtime($fullcompath . $entry); - $info["thumburl"] = THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . substr($entry, 0, -4) . ".jpg"; + $info["thumburl"] = THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . $withoutext . ".jpg"; if ( in_array($entry, $issues_read) ) { $info["read"] = true; $readclass = " readborder"; diff --git a/config-dist.php b/config-dist.php index 3bea0fd..0fcd0c0 100644 --- a/config-dist.php +++ b/config-dist.php @@ -29,6 +29,12 @@ define('EXTRACTSDIR', 'comics'); // define('ADULTMODE', false); +// +// The character count in the comic title where, when exceeded +// the folder/comic/series name will be removed for readability. +// +define('ISSUELENGTHCUTOFF', 25); + // // Database information for tracking last read page //