當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MediaInterface::getProviderReference方法代碼示例

本文整理匯總了PHP中Sonata\MediaBundle\Model\MediaInterface::getProviderReference方法的典型用法代碼示例。如果您正苦於以下問題:PHP MediaInterface::getProviderReference方法的具體用法?PHP MediaInterface::getProviderReference怎麽用?PHP MediaInterface::getProviderReference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sonata\MediaBundle\Model\MediaInterface的用法示例。


在下文中一共展示了MediaInterface::getProviderReference方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generate

 /**
  * {@inheritdoc}
  */
 public function generate(MediaProviderInterface $provider, MediaInterface $media)
 {
     $backend = $this->backend;
     $id = $this->id;
     $publish = function () use($backend, $media, $id) {
         $backend->createAndPublish('sonata.media.create_thumbnail', array('thumbnailId' => $id, 'mediaId' => $media->getId(), 'providerReference' => $media->getProviderReference()));
     };
     // BC compatibility for missing EventDispatcher
     if (null === $this->dispatcher) {
         trigger_error('Since version 2.3.3, passing an empty parameter in argument 4 for __construct() in ' . __CLASS__ . ' is deprecated and the workaround for it will be removed in 3.0.', E_USER_DEPRECATED);
         $publish();
     } else {
         $this->dispatcher->addListener('kernel.finish_request', $publish);
     }
 }
開發者ID:nicolasricci,項目名稱:SonataMediaBundle,代碼行數:18,代碼來源:ConsumerThumbnail.php

示例2: updateMetadata

 /**
  * {@inheritdoc}
  */
 public function updateMetadata(MediaInterface $media, $force = false)
 {
     $base = '//config.playwire.com/%d/videos/v2/%d/zeus.json';
     $ids = explode('|', $media->getProviderReference());
     $url = sprintf($base, $ids[0], $ids[1]);
     try {
         $metadata = $this->getMetadata($media, $url);
     } catch (\RuntimeException $e) {
         $media->setEnabled(false);
         $media->setProviderStatus(MediaInterface::STATUS_ERROR);
         return;
     }
     $media->setContentType($metadata['type']);
     $metadata['thumbnail_url'] = $metadata['content']['poster'];
     $imgsize = getimagesize($metadata['thumbnail_url']);
     $media->setWidth($imgsize[0]);
     $media->setHeight($imgsize[1]);
     $media->setProviderMetadata($metadata);
     if ($force) {
         $media->setName($metadata['settings']['title']);
     }
 }
開發者ID:NadirZenith,項目名稱:NzSonataMediaBundle,代碼行數:25,代碼來源:PlayWireProvider.php

示例3: getDownloadResponse

 /**
  * {@inheritdoc}
  */
 public function getDownloadResponse(MediaInterface $media, $format, $mode, array $headers = array())
 {
     return new RedirectResponse(sprintf('http://vimeo.com/%s', $media->getProviderReference()), 302, $headers);
 }
開發者ID:serialken,項目名稱:BugTracker,代碼行數:7,代碼來源:VimeoProvider.php

示例4: generate

 /**
  * {@inheritdoc}
  */
 public function generate(MediaProviderInterface $provider, MediaInterface $media)
 {
     $this->backend->createAndPublish('sonata.media.create_thumbnail', array('thumbnailId' => $this->id, 'mediaId' => $media->getId(), 'providerReference' => $media->getProviderReference()));
 }
開發者ID:nandorstanko,項目名稱:SonataMediaBundle,代碼行數:7,代碼來源:ConsumerThumbnail.php

示例5: updateMetadata

 /**
  * {@inheritdoc}
  */
 public function updateMetadata(MediaInterface $media, $force = false)
 {
     //http://api.soundcloud.com/resolve?url=http://soundcloud.com/matas/hobnotropic&client_id=656c5a7c166b49062f31fbf24eb13fcd
     /* $url = sprintf('http://videos.sapo.pt/oembed?url=http://videos.sapo.pt/%s&format=json', $media->getProviderReference()); */
     /* $url = sprintf('http://api.soundcloud.com/resolve?url=%s', $media->getProviderReference()); */
     /* $url = sprintf('http://soundcloud.com/oembed?url=%s&format=json&client_id=%s', $media->getProviderReference(), '656c5a7c166b49062f31fbf24eb13fcd'); */
     $url = sprintf('http://soundcloud.com/oembed?url=%s&format=json', $media->getProviderReference());
     try {
         $metadata = $this->getMetadata($media, $url);
         /* d($metadata); */
         /* $metadata_thumbnail = $this->getMetadataThumbnail($media); */
         /* $metadata = array_merge($metadata, $metadata_thumbnail); */
     } catch (\RuntimeException $e) {
         $media->setEnabled(false);
         $media->setProviderStatus(MediaInterface::STATUS_ERROR);
         return;
     }
     $media->setProviderMetadata($metadata);
     if ($force) {
         $media->setName($metadata['title']);
         $media->setAuthorName($metadata['author_name']);
     }
     $media->setHeight($metadata['height']);
     $media->setWidth($metadata['width']);
 }
開發者ID:NadirZenith,項目名稱:NzSonataMediaBundle,代碼行數:28,代碼來源:SoundcloudProvider.php


注:本文中的Sonata\MediaBundle\Model\MediaInterface::getProviderReference方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。