Hi folks,
We have altered the show.php file in our theme for a couple of reasons.
1. to display pdfs using pdf.js and pdf.js only
2. to show TIFs in the Docsviewer plugin
The full show.php is available here
but the important sections are as follows:
<!-- prevent pdf files from showing both in the item view and in the plugins /viewers (lines 8 - 11), fix to prevent images being thumbnailed as a knock-on (line 12) -->
<?php if ((get_theme_option('Item FileGallery') == 0) && metadata('item', 'has files')): ?>
<?php echo set_loop_records('files', $item->Files);
foreach (loop('files') as $file):
if ($file->getExtension() !='pdf'):
echo file_markup($file, array('imageSize' => 'fullsize'));
endif;
endforeach; ?>
<?php endif; ?>
<?php echo all_element_texts('item'); ?>
<!-- disply pdfs in pdf.js, which should be installed in /var/www/html/ (lines 23 - 24), if the file is not a pdf it can be displayed in plugins as normal (lines 26 -28) -->
<?php if (!$item) $item = get_current_record('item');
$files = $item->Files;
foreach($files as $file)
if ($file->getExtension() =='pdf'){
echo '<iframe width=100% height=800 src="http://deevy.nuim.ie/pdf.js/web/viewer.html?file=http://deevy.nuim.ie/files/original/'.metadata($file,'filename').'"></iframe>';
}
if($file->getExtension() !='pdf'){
fire_plugin_hook('public_items_show', array('view' => $this, 'item' => $item));
}
?>
This works some of the time but not all of the time. Whether it works or not depends on the order files are attached to the items in.
If the pdf is listed second things work as they should, see here for example: http://deevy.nuim.ie/items/show/88
However if the pdf is the first file listed things go awry.
In this example the file order is pdf followed by jpeg, see screengrab here. The pdf is dispayed in both pdf.js and the docs viewer: http://deevy.nuim.ie/items/show/84
There aren't a lot of items where this is an issue, and editing the item inside Omeka and dragging to change the file order isn't a big deal in this case. However for sharing or reusing the code things could be problematic.
Should item order change things?