Fix the conditional check for thumbnail existence before generation
This commit is contained in:
parent
bf8905f5f7
commit
1dd3a3bc70
|
|
@ -31,6 +31,11 @@ function compareNames($a, $b) {
|
||||||
return strnatcmp($a["name"], $b["name"]);
|
return strnatcmp($a["name"], $b["name"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data["compath"] = $compath;
|
||||||
|
$pathparts = pathinfo($compath);
|
||||||
|
$data["parentpath"] = $pathparts['dirname'];
|
||||||
|
$data["foldername"] = $pathparts['basename'];
|
||||||
|
|
||||||
$adultcomics = getAdultComics();
|
$adultcomics = getAdultComics();
|
||||||
|
|
||||||
$compath = $_SESSION['compath'];
|
$compath = $_SESSION['compath'];
|
||||||
|
|
@ -52,6 +57,7 @@ while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
|
||||||
$folders = array();
|
$folders = array();
|
||||||
$issues = array();
|
$issues = array();
|
||||||
$entries = scandir($fullcompath);
|
$entries = scandir($fullcompath);
|
||||||
|
$data["makethumb"] = array();
|
||||||
foreach ( $entries as $entry ) {
|
foreach ( $entries as $entry ) {
|
||||||
if ( ($entry == ".") || ($entry == "..") ) continue;
|
if ( ($entry == ".") || ($entry == "..") ) continue;
|
||||||
if ( (ADULTMODE || !$_SESSION['adult']) && in_array($entry, $adultcomics) ) continue;
|
if ( (ADULTMODE || !$_SESSION['adult']) && in_array($entry, $adultcomics) ) continue;
|
||||||
|
|
@ -79,7 +85,7 @@ foreach ( $entries as $entry ) {
|
||||||
$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);
|
||||||
$info["relcomic"] = base64_encode($compath . (($compath == "/") ? "" : "/") . $entry);
|
$info["relcomic"] = base64_encode($compath . (($compath == "/") ? "" : "/") . $entry);
|
||||||
$info["mtime"] = filemtime($fullcompath . $entry);
|
$info["mtime"] = filemtime($fullcompath . $entry);
|
||||||
$info["thumburl"] = htmlentities(THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . substr($entry, 0, -4), ENT_QUOTES) . ".jpg";
|
$info["thumburl"] = THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . substr($entry, 0, -4) . ".jpg";
|
||||||
if ( in_array($entry, $issues_read) ) {
|
if ( in_array($entry, $issues_read) ) {
|
||||||
$info["read"] = true;
|
$info["read"] = true;
|
||||||
$readclass = " readborder";
|
$readclass = " readborder";
|
||||||
|
|
@ -91,9 +97,11 @@ foreach ( $entries as $entry ) {
|
||||||
$info["div"] .= "<img class='issue' data-relcomic=\"{$info["relcomic"]}\" data-comname=\"{$info["comname"]}\" border=0 src=\"{$info["thumburl"]}\">";
|
$info["div"] .= "<img class='issue' data-relcomic=\"{$info["relcomic"]}\" data-comname=\"{$info["comname"]}\" border=0 src=\"{$info["thumburl"]}\">";
|
||||||
$info["div"] .= "<br clear=all /><a href=\"downloadcomic.php?comic={$info["relcomic"]}\">{$info["comname"]}</a></div>";
|
$info["div"] .= "<br clear=all /><a href=\"downloadcomic.php?comic={$info["relcomic"]}\">{$info["comname"]}</a></div>";
|
||||||
$issues[] = $info;
|
$issues[] = $info;
|
||||||
|
$thumbfile = "../" . THUMBSDIR . $data['compath'] . "/" . $info['comname'] . ".jpg";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( isset($info["thumburl"]) && !file_exists("../" . $info["thumburl"]) ) {
|
if ( isset($info["thumburl"]) && !file_exists("../" . $info["thumburl"]) ) {
|
||||||
|
$data["makethumb"][] = $info["thumburl"];
|
||||||
$havethumb = makeThumb($fullcompath . $entry);
|
$havethumb = makeThumb($fullcompath . $entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -107,10 +115,6 @@ if ( $_SESSION["sortorder"] == SORTBYNAME ) {
|
||||||
// Always sort issues by name
|
// Always sort issues by name
|
||||||
usort($issues, "compareNames");
|
usort($issues, "compareNames");
|
||||||
|
|
||||||
$data["compath"] = $compath;
|
|
||||||
$pathparts = pathinfo($compath);
|
|
||||||
$data["parentpath"] = $pathparts['dirname'];
|
|
||||||
$data["foldername"] = $pathparts['basename'];
|
|
||||||
$data["contents"] = array_merge($folders, $issues);
|
$data["contents"] = array_merge($folders, $issues);
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user