当前位置: 首页>>代码示例>>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;未经允许,请勿转载。