Change logic/order for detecting appropriate image types when extracting comics for showing
This commit is contained in:
parent
af6d0d8338
commit
6afdaeda78
|
|
@ -66,27 +66,24 @@ if ( $extracted ) {
|
||||||
$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);
|
|
||||||
if ( ! isset(pathinfo($imgname)['extension']) ) continue;
|
if ( ! isset(pathinfo($imgname)['extension']) ) continue;
|
||||||
$myext = strtolower(pathinfo($imgname)['extension']);
|
$myext = strtolower(pathinfo($imgname)['extension']);
|
||||||
if ( in_array($myext, VALIDIMAGETYPES) ) {
|
if ( ! in_array($myext, VALIDIMAGETYPES) ) continue;
|
||||||
$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);
|
||||||
if ( $written ) $files[] = $imgname;
|
if ( $written ) $files[] = $imgname;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} elseif ( $ext == "cbr" ) {
|
} elseif ( $ext == "cbr" ) {
|
||||||
$rar = RarArchive::open($comicfull);
|
$rar = RarArchive::open($comicfull);
|
||||||
$entries = $rar->getEntries();
|
$entries = $rar->getEntries();
|
||||||
foreach ( $entries as $entry ) {
|
foreach ( $entries as $entry ) {
|
||||||
$outfile = str_replace("#", "", basename($entry->getName()));
|
$outfile = str_replace("#", "", basename($entry->getName()));
|
||||||
$entry->extract(false, $comicoutputfull . $outfile);
|
|
||||||
if ( ! isset(pathinfo($outfile)['extension']) ) continue;
|
if ( ! isset(pathinfo($outfile)['extension']) ) continue;
|
||||||
$myext = strtolower(pathinfo($outfile)['extension']);
|
$myext = strtolower(pathinfo($outfile)['extension']);
|
||||||
if ( in_array($myext, VALIDIMAGETYPES) ) {
|
if ( ! in_array($myext, VALIDIMAGETYPES) ) continue;
|
||||||
$files[] = basename($outfile);
|
$entry->extract(false, $comicoutputfull . $outfile);
|
||||||
}
|
$files[] = basename($outfile);
|
||||||
}
|
}
|
||||||
unset($entry);
|
unset($entry);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user