Compare commits
2 Commits
50259400b4
...
ebb5325f99
| Author | SHA1 | Date | |
|---|---|---|---|
| ebb5325f99 | |||
| 93235c92ab |
|
|
@ -90,7 +90,7 @@ foreach ( $entries as $entry ) {
|
||||||
if ( strpos($withoutext, " - ") !== false ) {
|
if ( strpos($withoutext, " - ") !== false ) {
|
||||||
$info["comname"] = substr($withoutext, strpos($withoutext, " - ") + 3);
|
$info["comname"] = substr($withoutext, strpos($withoutext, " - ") + 3);
|
||||||
} else {
|
} else {
|
||||||
$info["comname"] = $withoutext;
|
$info["comname"] = (strlen($withoutext) >= ISSUELENGTHCUTOFF) ? substr($withoutext, strlen($compath)) : $withoutext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$info["comname"] = substr(((strpos($entry, " - ") !== false) ? str_replace(" - ", "<br />", $entry) : $entry), 0, -4);
|
//$info["comname"] = substr(((strpos($entry, " - ") !== false) ? str_replace(" - ", "<br />", $entry) : $entry), 0, -4);
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,8 @@ if ( !is_dir($comicoutputfull) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$extracted ) {
|
if ( !$extracted ) {
|
||||||
$magic = file_get_contents($comicfull, false, null, 0, 4);
|
$comtype = getComicType($comicfull);
|
||||||
if ( substr($magic, 0, 2) === "PK" ) {
|
if ( $comtype === COMICZIP ) {
|
||||||
$comtype = "cbz";
|
|
||||||
} elseif ( $magic === "Rar!" ) {
|
|
||||||
$comtype = "cbr";
|
|
||||||
}
|
|
||||||
if ( $comtype == "cbz" ) {
|
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
$opened = $zip->open($comicfull);
|
$opened = $zip->open($comicfull);
|
||||||
if ( !$opened ) {
|
if ( !$opened ) {
|
||||||
|
|
@ -101,7 +96,7 @@ if ( !$extracted ) {
|
||||||
}
|
}
|
||||||
$zip->close();
|
$zip->close();
|
||||||
}
|
}
|
||||||
} elseif ( $comtype == "cbr" ) {
|
} elseif ( $comtype === COMICRAR ) {
|
||||||
$rar = RarArchive::open($comicfull);
|
$rar = RarArchive::open($comicfull);
|
||||||
if ( $rar === false ) {
|
if ( $rar === false ) {
|
||||||
$data["error"] = true;
|
$data["error"] = true;
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,13 @@ a, a:link, a:visited, a:active {
|
||||||
.item {
|
.item {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 20vw;
|
width: 20vw;
|
||||||
height: calc(20vw * 1.5 + 2em);
|
height: calc(20vw * 1.5 + 2.5em);
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
border: 2px solid var(--foreground-color);
|
border: 2px solid var(--foreground-color);
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-size: 2vw;
|
font-size: 1.3vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,17 @@ function safeFileName($file = "") {
|
||||||
return str_replace($to_remove, "", $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 = "") {
|
function makeThumb($item = "") {
|
||||||
if ( $item == "" ) { return false; }
|
if ( $item == "" ) { return false; }
|
||||||
$prefix = (substr(getcwd(), -4) == "ajax") ? "../" : "";
|
$prefix = (substr(getcwd(), -4) == "ajax") ? "../" : "";
|
||||||
|
|
@ -51,7 +62,8 @@ function makeThumb($item = "") {
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( substr($comic, -3) == "cbz" ) {
|
$comtype = getComicType($comic);
|
||||||
|
if ( $comtype === COMICZIP ) {
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
$opened = $zip->open($comic);
|
$opened = $zip->open($comic);
|
||||||
if ( !$opened ) { return false; }
|
if ( !$opened ) { return false; }
|
||||||
|
|
@ -72,7 +84,7 @@ function makeThumb($item = "") {
|
||||||
if ( is_null($imgdata) ) return false;
|
if ( is_null($imgdata) ) return false;
|
||||||
$didwrite = file_put_contents($outfile, $imgdata);
|
$didwrite = file_put_contents($outfile, $imgdata);
|
||||||
if ( !$didwrite ) return false;
|
if ( !$didwrite ) return false;
|
||||||
} elseif ( substr($comic, -3) == "cbr" ) {
|
} elseif ( $comtype === COMICRAR ) {
|
||||||
$rar_file = RarArchive::open($comic);
|
$rar_file = RarArchive::open($comic);
|
||||||
if ( $rar_file === false ) { return false; }
|
if ( $rar_file === false ) { return false; }
|
||||||
$entries = $rar_file->getEntries();
|
$entries = $rar_file->getEntries();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user