Compare commits

..

No commits in common. "ebb5325f9942b1179c90a8610a09d7a59910180e" and "50259400b41ea7f8fe7637fb360a1ee023e7c684" have entirely different histories.

4 changed files with 13 additions and 20 deletions

View File

@ -90,7 +90,7 @@ foreach ( $entries as $entry ) {
if ( strpos($withoutext, " - ") !== false ) {
$info["comname"] = substr($withoutext, strpos($withoutext, " - ") + 3);
} else {
$info["comname"] = (strlen($withoutext) >= ISSUELENGTHCUTOFF) ? substr($withoutext, strlen($compath)) : $withoutext;
$info["comname"] = $withoutext;
}
}
//$info["comname"] = substr(((strpos($entry, " - ") !== false) ? str_replace(" - ", "<br />", $entry) : $entry), 0, -4);

View File

@ -75,8 +75,13 @@ if ( !is_dir($comicoutputfull) ) {
}
if ( !$extracted ) {
$comtype = getComicType($comicfull);
if ( $comtype === COMICZIP ) {
$magic = file_get_contents($comicfull, false, null, 0, 4);
if ( substr($magic, 0, 2) === "PK" ) {
$comtype = "cbz";
} elseif ( $magic === "Rar!" ) {
$comtype = "cbr";
}
if ( $comtype == "cbz" ) {
$zip = new ZipArchive();
$opened = $zip->open($comicfull);
if ( !$opened ) {
@ -96,7 +101,7 @@ if ( !$extracted ) {
}
$zip->close();
}
} elseif ( $comtype === COMICRAR ) {
} elseif ( $comtype == "cbr" ) {
$rar = RarArchive::open($comicfull);
if ( $rar === false ) {
$data["error"] = true;

View File

@ -63,13 +63,13 @@ a, a:link, a:visited, a:active {
.item {
cursor: pointer;
width: 20vw;
height: calc(20vw * 1.5 + 2.5em);
height: calc(20vw * 1.5 + 2em);
margin: 5px;
border: 2px solid var(--foreground-color);
padding: 2px;
display: inline-block;
overflow: hidden;
font-size: 1.3vw;
font-size: 2vw;
}
.thumbnail {

View File

@ -19,17 +19,6 @@ function safeFileName($file = "") {
return str_replace($to_remove, "", $file);
}
function getComicType(string $file = null): String|false {
$magic = file_get_contents($file, false, null, 0, 4);
$type = false;
if ( substr($magic, 0, 2) === "PK" ) {
$type = "cbz";
} elseif ( $magic === "Rar!" ) {
$type = "cbr";
}
return $type;
}
function makeThumb($item = "") {
if ( $item == "" ) { return false; }
$prefix = (substr(getcwd(), -4) == "ajax") ? "../" : "";
@ -62,8 +51,7 @@ function makeThumb($item = "") {
} else {
return false;
}
$comtype = getComicType($comic);
if ( $comtype === COMICZIP ) {
if ( substr($comic, -3) == "cbz" ) {
$zip = new ZipArchive();
$opened = $zip->open($comic);
if ( !$opened ) { return false; }
@ -84,7 +72,7 @@ function makeThumb($item = "") {
if ( is_null($imgdata) ) return false;
$didwrite = file_put_contents($outfile, $imgdata);
if ( !$didwrite ) return false;
} elseif ( $comtype === COMICRAR ) {
} elseif ( substr($comic, -3) == "cbr" ) {
$rar_file = RarArchive::open($comic);
if ( $rar_file === false ) { return false; }
$entries = $rar_file->getEntries();