If id3 library is not present show default image
Checks for getid3 library. Prevents site from failing. No images are fetched from audio files and will just show default image instead with a message on log saying to run install.
This commit is contained in:
parent
50450daca4
commit
88f90f33b9
|
@ -113,8 +113,13 @@ class FileDataHelper {
|
|||
*/
|
||||
public static function saveArtworkData($analyzeFile, $filename, $importDir = null, $DbPath = null)
|
||||
{
|
||||
if (class_exists('getID3')) {
|
||||
$getID3 = new \getID3();
|
||||
$getFileInfo = $getID3->analyze($analyzeFile);
|
||||
} else {
|
||||
$getFileInfo = [];
|
||||
Logging::error("Failed to load getid3 library. Please run either 'composer install' or the 'install' script.");
|
||||
}
|
||||
|
||||
if(isset($getFileInfo['comments']['picture'][0])) {
|
||||
|
||||
|
@ -188,8 +193,13 @@ class FileDataHelper {
|
|||
$dbAudioPath = $md["MDATA_KEY_FILEPATH"];
|
||||
$fullpath = $fp . $dbAudioPath;
|
||||
|
||||
if (class_exists('getID3')) {
|
||||
$getID3 = new \getID3();
|
||||
$getFileInfo = $getID3->analyze($fullpath);
|
||||
} else {
|
||||
$getFileInfo = [];
|
||||
Logging::error("Failed to load getid3 library. Please run either 'composer install' or the 'install' script.");
|
||||
}
|
||||
|
||||
if(isset($getFileInfo['comments']['picture'][0])) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue