Add webp support to image type. Can't make thumbnails on (ancient) moon
This commit is contained in:
parent
feb69966d6
commit
5b49a8b6e4
|
@ -44,8 +44,9 @@ if ( $ext == "cbz" ) {
|
|||
$opened = $zip->open($comicfull);
|
||||
for ( $i=0; $i<$zip->numFiles; $i++ ) {
|
||||
$imgname = basename($zip->getNameIndex($i));
|
||||
$myext = substr($imgname, -3);
|
||||
if ( ($myext == "jpg") || ($myext == "png") ) {
|
||||
//$myext = substr($imgname, -3);
|
||||
$myext = strtolower(pathinfo($imgname)['extension']);
|
||||
if ( ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) {
|
||||
$imgname = str_replace("#", "", $imgname);
|
||||
$imgcontents = $zip->getFromIndex($i);
|
||||
$written = file_put_contents($comicoutputfull . $imgname, $imgcontents);
|
||||
|
@ -58,8 +59,9 @@ if ( $ext == "cbz" ) {
|
|||
while ( false !== ($file = readdir($fh)) ) {
|
||||
$myfile = $comicoutputfull . $file;
|
||||
$mynewfile = $comicoutputfull . str_replace("#", "", $file);
|
||||
$myext = strtolower(substr($file, -3));
|
||||
if ( ($myext == "jpg") || ($myext == "png") ) {
|
||||
//$myext = strtolower(substr($file, -3));
|
||||
$myext = strtolower(pathinfo($imgname)['extension']);
|
||||
if ( ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) {
|
||||
rename($myfile, $mynewfile);
|
||||
$files[] = basename($mynewfile);
|
||||
}
|
||||
|
|
|
@ -45,9 +45,11 @@ function makeThumb($item = "") {
|
|||
$imgdata = null;
|
||||
for ( $i=0; $i<$zip->numFiles; $i++ ) {
|
||||
$imgname = basename($zip->getNameIndex($i));
|
||||
$imgext = strtolower(pathinfo($imgname)['extension']);
|
||||
if ( (strcmp($lowest, $imgname) > 0)
|
||||
&& ((strcasecmp(substr($imgname, -3), "jpg") == 0)
|
||||
|| (strcasecmp(substr($imgname, -3), "png") == 0)) ) {
|
||||
&& ((strcasecmp($imgext, "jpg") == 0)
|
||||
|| (strcasecmp($imgext, "png") == 0)
|
||||
|| (strcasecmp($imgext, "webp") == 0)) ) {
|
||||
$lowest = $imgname;
|
||||
$imgdata = $zip->getFromIndex($i);
|
||||
}
|
||||
|
@ -63,11 +65,12 @@ function makeThumb($item = "") {
|
|||
$lowest = "~";
|
||||
foreach ( $entries as $entry ) {
|
||||
$imgname = $entry->getName();
|
||||
$imgext = strtolower(pathinfo($imgname)['extension']);
|
||||
if ( (strcmp($lowest, $imgname) > 0)
|
||||
&& ((strcasecmp(substr($imgname, -3), "jpg") == 0)
|
||||
|| (strcasecmp(substr($imgname, -3), "png") == 0)) ) {
|
||||
&& ((strcasecmp($imgext, "jpg") == 0)
|
||||
|| (strcasecmp($imgext, "png") == 0)
|
||||
|| (strcasecmp($imgext, "webp") == 0)) ) {
|
||||
$lowest = $imgname;
|
||||
$ext = strtolower(substr($imgname, -3));
|
||||
$didwrite = $entry->extract(false, $outfile);
|
||||
if ( !$didwrite ) { return false; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user