toTmpFile($path); $tags = $getID3->analyze($tmppath); \getid3_lib::CopyTagsToComments($tags); $picture = @$tags['id3v2']['APIC'][0]['data']; unlink($tmppath); $image = new \OC_Image($picture); return $image->valid() ? $image : $this->getNoCoverThumbnail($maxX, $maxY); } public function getNoCoverThumbnail($maxX, $maxY) { $icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.png'; if(!file_exists($icon)) { return false; } $image = new \OC_Image($icon); return $image->valid() ? $image : false; } } \OC\PreviewManager::registerProvider('OC\Preview\MP3');