public function sliderExhibitAttachment($attachment) { $item = $attachment->getItem(); $file = $attachment->getFile(); if ($file) { if (!isset($fileOptions['imgAttributes']['alt'])) { $fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true)); } if ($forceImage) { $imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail'; $image = file_image($imageSize, $fileOptions['imgAttributes'], $file); $html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item); } else { if (!isset($fileOptions['linkAttributes']['href'])) { $fileOptions['linkAttributes']['href'] = exhibit_builder_exhibit_item_uri($item); } $html = file_markup($file, $fileOptions, null); } } else { if ($item) { $html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item); } } // Don't show a caption if we couldn't show the Item or File at all if (isset($html)) { if (!is_string($attachment['caption']) || $attachment['caption'] == '') { return ''; } $html .= '<div class="exhibit-item-caption">' . $attachment['caption'] . '</div>'; return apply_filters('exhibit_attachment_caption', $html, array('attachment' => $attachment)); } else { $html = ''; } return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage')); }
/** * Return the markup for displaying an exhibit attachment. * * @param ExhibitBlockAttachment $attachment * @param array $fileOptions Array of options for file_markup * @param array $linkProps Array of options for exhibit_builder_link_to_exhibit_item * @param boolean $forceImage Whether to display the attachment as an image * always Defaults to false. * @return string */ public function exhibitAttachmentLightboxBook($attachment, $fileOptions = array(), $linkProps = array(), $forceImage = false, $pageCount = 0) { $item = $attachment->getItem(); $file = $attachment->getFile(); $caption = $attachment['caption']; if ($file) { if (!isset($fileOptions['imgAttributes']['alt'])) { $fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title')); } if (!isset($fileOptions['linkAttributes']['data-lightbox'])) { $fileOptions['linkAttributes']['data-lightbox'] = 'lightbox-gallery'; } if ($caption) { $fileOptions['linkAttributes']['data-title'] = $caption; } if ($pageCount > 0) { $fileOptions['linkAttributes']['class'] = "download-file later-pages"; } if ($forceImage) { $imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail'; $image = file_image($imageSize, $fileOptions['imgAttributes'], $file); $html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item); } else { $html = file_markup($file, $fileOptions, null); } } else { if ($item) { $html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item); } } return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage')); }
/** * Return the markup for displaying an exhibit attachment. * * @param ExhibitBlockAttachment $attachment * @param array $fileOptions Array of options for file_markup * @param array $linkProps Array of options for exhibit_builder_link_to_exhibit_item * @param boolean $forceImage Whether to display the attachment as an image * always Defaults to false. * @return string */ public function exhibitAttachment($attachment, $fileOptions = array(), $linkProps = array(), $forceImage = false) { $item = $attachment->getItem(); $file = $attachment->getFile(); if ($file) { if (!isset($fileOptions['imgAttributes']['alt'])) { $fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true)); } if ($forceImage) { $imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail'; $image = file_image($imageSize, $fileOptions['imgAttributes'], $file); $html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item); } else { if (!isset($fileOptions['linkAttributes']['href'])) { $fileOptions['linkAttributes']['href'] = exhibit_builder_exhibit_item_uri($item); } $html = file_markup($file, $fileOptions, null); } } else { if ($item) { $html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item); } } // Don't show a caption if we couldn't show the Item or File at all if (isset($html)) { $html .= $this->view->exhibitAttachmentCaption($attachment); } else { $html = ''; } return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage')); }
function custom_item_image_gallery($attrs = array(), $imageType = 'square_thumbnail', $filesShow = false, $item = null) { if (!$item) { $item = get_current_record('item'); } $files = $item->Files; if (!$files) { return ''; } $defaultAttrs = array('wrapper' => array('id' => 'item-images'), 'linkWrapper' => array(), 'link' => array(), 'image' => array()); $attrs = array_merge($defaultAttrs, $attrs); $html = ''; if ($attrs['wrapper'] !== null) { $html .= '<div ' . tag_attributes($attrs['wrapper']) . '>' . "\n"; } foreach ($files as $file) { if ($attrs['linkWrapper'] !== null) { $html .= '<div ' . tag_attributes($attrs['linkWrapper']) . '>' . "\n"; } $fileTitle = metadata($file, 'display title'); $webPath = $file->getWebPath('original'); // Taille de l'image en fonction du type de fichier if (preg_match("/\\.jpg\$/", $webPath)) { $imageType = 'fullsize'; $attrs['image'] = array('style' => 'max-width: 100%'); } else { $imageType = 'thumbnail'; $attrs['image'] = array('style' => 'width:5em;vertical-align:middle;'); } $image = file_image($imageType, $attrs['image'], $file); $html .= '<h2 class="title" style="text-align:center;">' . $fileTitle . '</h2>' . "\n"; if ($filesShow) { $html .= link_to($file, 'show', $image, $attrs['link']); } else { if (preg_match("/\\.pdf\$/", $webPath)) { $html .= '<p style="padding:0 1em 1em 1em;color: #333333;">Télécharger le fichier PDF : '; } $linkAttrs = $attrs['link'] + array('href' => $webPath); $html .= '<a ' . tag_attributes($linkAttrs) . '>' . $image . '</a>' . "\n"; if (preg_match("/\\.pdf\$/", $webPath)) { $html .= '</p>'; } } if ($attrs['linkWrapper'] !== null) { $html .= '</div>' . "\n"; } } if ($attrs['wrapper'] !== null) { $html .= '</div>' . "\n"; } return $html; }
/** * Return the form for showing an item to be attached. * * @param Item $item * @return string */ public function exhibitItemListing($item) { $html = '<div class="item-listing" data-item-id="' . $item->id . '">'; if (metadata($item, 'has files')) { foreach ($item->Files as $displayFile) { if ($displayFile->hasThumbnail()) { $html .= '<div class="item-file">' . file_image('square_thumbnail', array(), $displayFile) . '</div>'; break; } } } $private = ''; if (!metadata($item, 'public')) { $private = ' ' . __('(Private)'); } $html .= '<h4 class="title">' . metadata($item, array('Dublin Core', 'Title')) . $private . '</h4>'; $html .= '<button type="button" class="select-item">' . __('Select Item') . '</button>'; $html .= '</div>'; return $html; }
/** * Get a gallery of file thumbnails for an item. * * @package Omeka\Function\View\Item * @param array $attrs HTML attributes for the components of the gallery, in * sub-arrays for 'wrapper', 'linkWrapper', 'link', and 'image'. Set a wrapper * to null to omit it. * @param string $imageType The type of derivative image to display. * @param boolean $filesShow Whether to link to the files/show. Defaults to * false, links to the original file. * @param Item $item The Item to use, the current item if omitted. * @return string */ function item_image_gallery($attrs = array(), $imageType = 'square_thumbnail', $filesShow = false, $item = null) { if (!$item) { $item = get_current_record('item'); } $files = $item->Files; if (!$files) { return ''; } $defaultAttrs = array('wrapper' => array('id' => 'item-images'), 'linkWrapper' => array(), 'link' => array(), 'image' => array()); $attrs = array_merge($defaultAttrs, $attrs); $html = ''; if ($attrs['wrapper'] !== null) { $html .= '<div ' . tag_attributes($attrs['wrapper']) . '>'; } foreach ($files as $file) { if ($attrs['linkWrapper'] !== null) { $html .= '<div ' . tag_attributes($attrs['linkWrapper']) . '>'; } $image = file_image($imageType, $attrs['image'], $file); if ($filesShow) { $html .= link_to($file, 'show', $image, $attrs['link']); } else { $linkAttrs = $attrs['link'] + array('href' => $file->getWebPath('original')); $html .= '<a ' . tag_attributes($linkAttrs) . '>' . $image . '</a>'; } if ($attrs['linkWrapper'] !== null) { $html .= '</div>'; } } if ($attrs['wrapper'] !== null) { $html .= '</div>'; } return $html; }
<!DOCTYPE html> <html> <head> <?php queue_css_file('style'); $css = "\ndiv.content {margin-right: 10px; max-width:310px;}\ndiv.thumbnail {float:right;}\nh1 {margin: 0;}\n\n\n"; queue_css_string($css); echo head_css(); ?> </head> <body> <div class="thumbnail"><?php echo file_image('thumbnail', array(), $files[0]); ?> </div> </body> </html>
</head> <body> <div style="width: 500px; padding: 5px;"> <!-- Item Image Files --> <?php if (metadata('item', 'has files')) { ?> <?php $files = $item->Files; ?> <div class="image-thumb"> <a href="<?php echo file_display_url($files[0], $format = 'original'); ?> "><?php echo file_image('fullsize', array(), $files[0]); ?> </a> <p class="post-image">(click image to see high quality files)</p> </div> <?php } ?> <div class='content'> <h1><a target='_blank' href="<?php echo file_display_url($files[0], $format = 'original'); ?> "><?php echo metadata('item', array('Dublin Core', 'Title')); ?> </a></h1>
$fileTitle = metadata($file, array('Dublin Core', 'Title')); // Using monospaced font to make this work if (strlen($fileTitle) <= 18) { $fileTitle .= '<br /><br /><br />'; } elseif (strlen($fileTitle) <= 36) { $fileTitle .= '<br /><br />'; } ?> <li class="span2" style="display: inline-block; vertical-align: top; width: 10%;"> <div class="thumbnail thumbnail-smaller"> <a href="<?php echo url(array('action' => 'transcribe', 'item-id' => $file->item_id, 'file-id' => $file->id), 'scripto_action_item_file'); ?> "> <?php echo file_image('square_thumbnail', array(), $file); ?> </a> <h4><?php echo $fileTitle; ?> </h4> <span class="label <?php echo $label; ?> "><?php if ($status == 'Completed') { echo "Terminado"; } if ($status == 'Needs Review') { echo "Requiere revisión";
<div id="secondary"> <!-- The following returns all of the files associated with an item. --> <?php if (get_theme_option('Item FileGallery') == 1 && metadata($item, 'has files')) { ?> <div id="itemfiles" class="element"> <h2>Files</h2> <?php $itemFiles = $item->Files; ?> <?php foreach ($itemFiles as $itemFile) { ?> <div class="poster element-text"><?php echo link_to($itemFile, 'show', file_image('original', array(), $itemFile)); ?> </div> <?php } ?> </div> <?php } ?> <!-- The following prints a list of all tags associated with the item --> <?php if (metadata($item, 'has tags')) {
/** * Get a gallery of file thumbnails for an item. * * @package Omeka\Function\View\Item * @param array $attrs HTML attributes for the components of the gallery, in * sub-arrays for 'wrapper', 'linkWrapper', 'link', and 'image'. Set a wrapper * to null to omit it. * @param string $imageType The type of derivative image to display. * @param boolean $filesShow Whether to link to the files/show. Defaults to * false, links to the original file. * @param Item $item The Item to use, the current item if omitted. * @return string */ function item_image_gallery($attrs = array(), $imageType = 'square_thumbnail', $filesShow = false, $item = null, $caption = false, $onlyImages = false) { if (!$item) { $item = get_current_record('item'); } $files = $item->Files; if (!$files) { return ''; } foreach ($files as $key => $file) { if ($onlyImages && $file->getExtension() == 'pdf') { unset($files[$key]); } } $defaultAttrs = array('wrapper' => array('id' => 'item-images'), 'linkWrapper' => array(), 'link' => array(), 'image' => array()); $attrs = array_merge($defaultAttrs, $attrs); $html = ''; if ($attrs['wrapper'] !== null) { $html .= '<div ' . tag_attributes($attrs['wrapper']) . '>'; } $i = 1; $j = 0; foreach ($files as $key => $file) { if ($j < 3) { $j++; } $i++; if ($attrs['linkWrapper'] !== null) { $html .= '<div ' . tag_attributes($attrs['linkWrapper']) . '>'; } $image = file_image($imageType, $attrs['image'], $file); if ($filesShow) { $html .= link_to($file, 'show', $image, $attrs['link']); } else { $linkAttrs = $attrs['link'] + array('href' => $file->getWebPath('original')); $linkAttrs['href'] = getenv("INSTANCE_URL") . '/items/images/' . $item->id . '?image=' . $file->id; if (!is_admin_theme()) { $html .= '<a target="_blank" href="' . $linkAttrs['href'] . '" class="enlarge-image"></a>'; } $html .= '<a '; if ($i > 1 && ($i - 1) % 3 == 0) { $html .= ' class="last" '; } $html .= tag_attributes($linkAttrs) . '>'; $html .= $image; $html .= '</a>'; } if ($attrs['linkWrapper'] !== null) { $html .= '</div>'; } } if ($attrs['wrapper'] !== null) { $html .= '</div>'; } if (count($files) == 1) { $width = 220; } elseif (count($files) == 2) { $width = 458; } else { $width = 700; } if (!is_admin_theme() && $caption) { $html .= '<div class="caption" style="width:' . $width . 'px;";>' . $caption . '</div>'; } return $html; }
function sckls_item_image_gallery($attrs = array(), $imageType = 'fullsize', $filesShow = false, $item = null) { if (!$item) { $item = get_current_record('item'); } $files = $item->Files; if (!$files) { return ''; } $defaultAttrs = array('wrapper' => array('id' => 'item-images'), 'linkWrapper' => array(), 'link' => array(), 'image' => array()); $attrs = array_merge($defaultAttrs, $attrs); $count = 1; $html = ''; foreach ($files as $file) { $mime = $file->mime_type; // Is it the first item? If so, give it a special class name if ($count == 1) { $class = 'image-large'; $image = file_image($imageType, array('size' => 'fullsize'), $file); } else { $class = 'image-small'; $image = file_image($imageType, $attrs['image'], $file); } // Setup list items with appropriate classes if (strstr($mime, 'image') == true) { $html .= '<ul id="image-gallery" class="clearfix"><li data-src="' . $file->getWebPath('original') . '" class="' . $class . '">'; $html .= $image . ''; } elseif (strstr($mime, 'video') == true) { $html .= '<ul id="show-item-av"><li data-src="' . $file->getWebPath('original') . '"><video src="' . $file->getWebPath('original') . '" width="100%" controls></video>'; $html; } elseif (strstr($mime, 'audio') == true) { $html .= '<ul id="show-item-av"><li data-src="' . $file->getWebPath('original') . '"><img src="/cm-images/audio-placeholder.png" alt="Audio recording" id="audioplaceholder" /><audio src="' . $file->getWebPath('original') . '" width="100%" controls></audio>'; $html; } else { $html .= '<li data-iframe="true" data-src="' . $file->getWebPath('original') . '" class="' . $class . '">'; } // Get the files/images // $html .= $image; $html .= '</li></ul>'; $count++; } return $html; }
function file_proc($file) { // file exist check if ( !file_exists($file) ) { echo "$file: <font color=red>"._AM_IMPORT_ERRFILEEXI."</font><br>\n"; return; } // .html .htm elseif ( preg_match('/\.html$/i', $file) || preg_match('/\.htm$/i', $file) ) { file_html($file); } // .txt elseif ( preg_match('/\.txt$/i', $file) ) { file_text($file); } // .gif .jpg .jpeg .png elseif ( preg_match('/\.gif$/i', $file) || preg_match('/\.jp(e?)g$/i', $file) || preg_match('/\.png$/i', $file) ) { file_image($file); } }