public function getThumbnail($thumbnailName, $onlyFormats = [])
{
$thumbnail = $this->getThumbnailConfig($thumbnailName);
if ($thumbnail) {
try {
Video\Thumbnail\Processor::process($this, $thumbnail, $onlyFormats);
// check for existing videos
$customSetting = $this->getCustomSetting("thumbnails");
if (is_array($customSetting) && array_key_exists($thumbnail->getName(), $customSetting)) {
foreach ($customSetting[$thumbnail->getName()]["formats"] as &$path) {
$fullPath = $this->getVideoThumbnailSavePath() . $path;
$path = str_replace(PIMCORE_DOCUMENT_ROOT, "", $fullPath);
$path = urlencode_ignore_slash($path);
$results = \Pimcore::getEventManager()->trigger("frontend.path.asset.video.thumbnail", $this, ["filesystemPath" => $fullPath, "frontendPath" => $path]);
if ($results->count()) {
$path = $results->last();
}
}
return $customSetting[$thumbnail->getName()];
}
} catch (\Exception $e) {
Logger::error("Couldn't create thumbnail of video " . $this->getRealFullPath());
Logger::error($e);
}
}
return null;
}