Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * 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 '';
     }
 }
Ejemplo n.º 3
0
 /**
  * {@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());
     }
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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()));
 }
Ejemplo n.º 7
0
 public function updateForm(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     return $this->getForm($view, 'media-html', $media->mediaData()['html']);
 }
Ejemplo n.º 8
0
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     return sprintf('<img src="%s">', $view->escapeHtml($media->originalUrl()));
 }
Ejemplo n.º 9
0
 /**
  * {@inheritDoc}
  */
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     $data = $media->mediaData();
     return $data['html'];
 }