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