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
 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.º 3
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.º 4
0
 public function updateForm(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     return $this->getForm($view, 'media-html', $media->mediaData()['html']);
 }
Ejemplo n.º 5
0
 /**
  * {@inheritDoc}
  */
 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     $data = $media->mediaData();
     return $data['html'];
 }