Compare commits

...

2 Commits

3 changed files with 17 additions and 11 deletions

View File

@ -83,13 +83,14 @@ foreach ( $entries as $entry ) {
} }
} }
// Sort folders based on current sort order
if ( $_SESSION["sortorder"] == SORTBYNAME ) { if ( $_SESSION["sortorder"] == SORTBYNAME ) {
usort($folders, "compareNames"); usort($folders, "compareNames");
usort($issues, "compareNames");
} else { } else {
usort($folders, "compareDates"); usort($folders, "compareDates");
usort($issues, "compareDates");
} }
// Always sort issues by name
usort($issues, "compareNames");
$data["compath"] = $compath; $data["compath"] = $compath;
$data["contents"] = array_merge($folders, $issues); $data["contents"] = array_merge($folders, $issues);

View File

@ -44,8 +44,9 @@ if ( $ext == "cbz" ) {
$opened = $zip->open($comicfull); $opened = $zip->open($comicfull);
for ( $i=0; $i<$zip->numFiles; $i++ ) { for ( $i=0; $i<$zip->numFiles; $i++ ) {
$imgname = basename($zip->getNameIndex($i)); $imgname = basename($zip->getNameIndex($i));
$myext = substr($imgname, -3); //$myext = substr($imgname, -3);
if ( ($myext == "jpg") || ($myext == "png") ) { $myext = strtolower(pathinfo($imgname)['extension']);
if ( ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) {
$imgname = str_replace("#", "", $imgname); $imgname = str_replace("#", "", $imgname);
$imgcontents = $zip->getFromIndex($i); $imgcontents = $zip->getFromIndex($i);
$written = file_put_contents($comicoutputfull . $imgname, $imgcontents); $written = file_put_contents($comicoutputfull . $imgname, $imgcontents);
@ -58,8 +59,9 @@ if ( $ext == "cbz" ) {
while ( false !== ($file = readdir($fh)) ) { while ( false !== ($file = readdir($fh)) ) {
$myfile = $comicoutputfull . $file; $myfile = $comicoutputfull . $file;
$mynewfile = $comicoutputfull . str_replace("#", "", $file); $mynewfile = $comicoutputfull . str_replace("#", "", $file);
$myext = strtolower(substr($file, -3)); //$myext = strtolower(substr($file, -3));
if ( ($myext == "jpg") || ($myext == "png") ) { $myext = strtolower(pathinfo($imgname)['extension']);
if ( ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) {
rename($myfile, $mynewfile); rename($myfile, $mynewfile);
$files[] = basename($mynewfile); $files[] = basename($mynewfile);
} }

View File

@ -45,9 +45,11 @@ function makeThumb($item = "") {
$imgdata = null; $imgdata = null;
for ( $i=0; $i<$zip->numFiles; $i++ ) { for ( $i=0; $i<$zip->numFiles; $i++ ) {
$imgname = basename($zip->getNameIndex($i)); $imgname = basename($zip->getNameIndex($i));
$imgext = strtolower(pathinfo($imgname)['extension']);
if ( (strcmp($lowest, $imgname) > 0) if ( (strcmp($lowest, $imgname) > 0)
&& ((strcasecmp(substr($imgname, -3), "jpg") == 0) && ((strcasecmp($imgext, "jpg") == 0)
|| (strcasecmp(substr($imgname, -3), "png") == 0)) ) { || (strcasecmp($imgext, "png") == 0)
|| (strcasecmp($imgext, "webp") == 0)) ) {
$lowest = $imgname; $lowest = $imgname;
$imgdata = $zip->getFromIndex($i); $imgdata = $zip->getFromIndex($i);
} }
@ -63,11 +65,12 @@ function makeThumb($item = "") {
$lowest = "~"; $lowest = "~";
foreach ( $entries as $entry ) { foreach ( $entries as $entry ) {
$imgname = $entry->getName(); $imgname = $entry->getName();
$imgext = strtolower(pathinfo($imgname)['extension']);
if ( (strcmp($lowest, $imgname) > 0) if ( (strcmp($lowest, $imgname) > 0)
&& ((strcasecmp(substr($imgname, -3), "jpg") == 0) && ((strcasecmp($imgext, "jpg") == 0)
|| (strcasecmp(substr($imgname, -3), "png") == 0)) ) { || (strcasecmp($imgext, "png") == 0)
|| (strcasecmp($imgext, "webp") == 0)) ) {
$lowest = $imgname; $lowest = $imgname;
$ext = strtolower(substr($imgname, -3));
$didwrite = $entry->extract(false, $outfile); $didwrite = $entry->extract(false, $outfile);
if ( !$didwrite ) { return false; } if ( !$didwrite ) { return false; }
} }