|
|
@ -565,7 +565,7 @@ function handle_report() |
|
|
|
); |
|
|
|
|
|
|
|
// You can get your webhook endpoint from your Slack settings |
|
|
|
// For some reason using the configuration key doesn't work |
|
|
|
// For some reason using the configuration key doesn't work |
|
|
|
$ch = curl_init($config['slack_incoming_webhook_endpoint']); |
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
|
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
|
|
@ -1278,28 +1278,28 @@ function handle_post() |
|
|
|
$file['width'] = $size[0]; |
|
|
|
$file['height'] = $size[1]; |
|
|
|
} |
|
|
|
/*if (($file['extension'] == "epub" && $config['epub_file_thumbnail'])){ |
|
|
|
/*if (($file['extension'] == "epub" && $config['epub_file_thumbnail'])){ |
|
|
|
$path = $file['thumb']; |
|
|
|
// Open epub |
|
|
|
// Get file list |
|
|
|
// Check if cover file exists according to regex if it does use it |
|
|
|
// Otherwise check if metadata file exists, and if does get rootfile and search for manifest for cover file name |
|
|
|
// Otherwise check if metadata file exists, and if does get rootfile and search for manifest for cover file name |
|
|
|
// Otherwise Check if other image files exist and use them, based on criteria to pick the best one. |
|
|
|
// Once we have filename extract said file from epub to file['thumb'] location. |
|
|
|
// Once we have filename extract said file from epub to file['thumb'] location. |
|
|
|
$zip = new ZipArchive(); |
|
|
|
if(@$zip->open($path)){ |
|
|
|
$filename = ""; |
|
|
|
// Go looking for a file name, current implementation just uses regex but should fallback to |
|
|
|
// getting all images and then choosing one. |
|
|
|
for( $i = 0; $i < $zip->numFiles; $i++ ){ |
|
|
|
$stat = $zip->statIndex( $i ); |
|
|
|
for( $i = 0; $i < $zip->numFiles; $i++ ){ |
|
|
|
$stat = $zip->statIndex( $i ); |
|
|
|
$matches = array(); |
|
|
|
if (preg_match('/.*cover.*\.(jpg|jpeg|png)/', $stat['name'], $matches)) { |
|
|
|
$filename = $matches[0]; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
// We have a cover filename to extract. |
|
|
|
} |
|
|
|
// We have a cover filename to extract. |
|
|
|
if (strlen($filename) > 0){ |
|
|
|
//$zip->extractTo(dirname($file['thumb']), array($filename)); |
|
|
|
} |
|
|
@ -1311,9 +1311,9 @@ function handle_post() |
|
|
|
else { |
|
|
|
$error = 1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($error){ |
|
|
|
$path = sprintf($config['file_thumb'],isset($config['file_icons'][$file['extension']]) ? $config['file_icons'][$file['extension']] : $config['file_icons']['default']); |
|
|
|
$path = sprintf($config['file_thumb'],isset($config['file_icons'][$file['extension']]) ? $config['file_icons'][$file['extension']] : $config['file_icons']['default']); |
|
|
|
} |
|
|
|
|
|
|
|
$file['thumb'] = basename($file['thumb']); |
|
|
|