process() public static method

public static process ( Video $asset, $config, array $onlyFormats = [] ) : Processor
$asset Pimcore\Model\Asset\Video
$config
$onlyFormats array
return Processor
Exemplo n.º 1
0
 /**
  * Returns a path to a given thumbnail or an thumbnail configuration
  *
  * @param mixed
  * @return string
  */
 public function getThumbnail($thumbnailName, $onlyFormats = array())
 {
     $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)) {
                 return $customSetting[$thumbnail->getName()];
             }
         } catch (\Exception $e) {
             \Logger::error("Couldn't create thumbnail of video " . $this->getFullPath());
             \Logger::error($e);
         }
     }
     return null;
 }
Exemplo n.º 2
0
 /**
  * Returns a path to a given thumbnail or an thumbnail configuration
  *
  * @param mixed
  * @return string
  */
 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;
 }