示例#1
0
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     $data = $media->mediaData();
     if ($data['type'] == 'photo') {
         $url = $data['url'];
         $width = $data['width'];
         $height = $data['height'];
         if (!empty($data['title'])) {
             $title = $data['title'];
         } else {
             $title = $url;
         }
         return sprintf('<img src="%s" width="%s" height="%s" alt="%s">', $view->escapeHtml($url), $view->escapeHtml($width), $view->escapeHtml($height), $view->escapeHtml($title));
     } else {
         if (!empty($data['html'])) {
             return $data['html'];
         } else {
             $source = $media->source();
             if (!$empty($data['title'])) {
                 $title = $data['title'];
             } else {
                 $title = $source;
             }
             return $view->hyperlink($title, $source);
         }
     }
 }
示例#2
0
文件: Media.php 项目: patrova/omeka-s
 /**
  * Return the HTML necessary to render an edit form.
  *
  * @param MediaRepresentation $media
  * @param array $options Global options for the media update form
  * @return string
  */
 public function updateForm(MediaRepresentation $media, array $options = [])
 {
     $ingester = $this->ingesterManager->get($media->ingester());
     if ($ingester instanceof MutableIngesterInterface) {
         return $ingester->updateForm($this->getView(), $media, $options);
     } else {
         return '';
     }
 }
示例#3
0
文件: File.php 项目: patrova/omeka-s
 /**
  * {@inheritDoc}
  */
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     try {
         $renderer = $this->getServiceLocator()->get('Omeka\\FileRendererManager')->get($media->mediaType());
         return $renderer->render($view, $media, $options);
     } catch (ServiceNotFoundException $e) {
         return $view->hyperlink($media->filename(), $media->originalUrl());
     }
 }
示例#4
0
文件: IIIF.php 项目: patrova/omeka-s
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     $IIIFData = $media->mediaData();
     $view->headScript()->appendFile($view->assetUrl('js/openseadragon/openseadragon.min.js', 'Omeka'));
     $prefixUrl = $view->assetUrl('js/openseadragon/images/', 'Omeka');
     $image = '<div class="openseadragon" id="iiif-' . $media->id() . '"></div>
         <script type="text/javascript">
             var viewer = OpenSeadragon({
                 id: "iiif-' . $media->id() . '",
                 prefixUrl: "' . $prefixUrl . '",
                 tileSources: [
                     ' . json_encode($IIIFData) . '
                 ]
             });
         </script>';
     return $image;
 }
示例#5
0
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     if (!isset($options['width'])) {
         $options['width'] = self::WIDTH;
     }
     if (!isset($options['height'])) {
         $options['height'] = self::HEIGHT;
     }
     if (!isset($options['allowfullscreen'])) {
         $options['allowfullscreen'] = self::ALLOWFULLSCREEN;
     }
     // Compose the YouTube embed URL and build the markup.
     $data = $media->mediaData();
     $url = new HttpUri(sprintf('https://www.youtube.com/embed/%s', $data['id']));
     $url->setQuery(['start' => $data['start'], 'end' => $data['end']]);
     $embed = sprintf('<iframe width="%s" height="%s" src="%s" frameborder="0"%s></iframe>', $view->escapeHtml($options['width']), $view->escapeHtml($options['height']), $view->escapeHtml($url), $options['allowfullscreen'] ? ' allowfullscreen' : '');
     return $embed;
 }
示例#6
0
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     return sprintf('<audio src="%s" controls>%s</audio>', $view->escapeHtml($media->originalUrl()), $view->hyperlink($media->filename(), $media->originalUrl()));
 }
示例#7
0
文件: Html.php 项目: patrova/omeka-s
 public function updateForm(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     return $this->getForm($view, 'media-html', $media->mediaData()['html']);
 }
示例#8
0
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     return sprintf('<img src="%s">', $view->escapeHtml($media->originalUrl()));
 }
示例#9
0
文件: Html.php 项目: patrova/omeka-s
 /**
  * {@inheritDoc}
  */
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     $data = $media->mediaData();
     return $data['html'];
 }