Integrate LightBox to Omeka Exhibit Builder

Hello everyone,

I’m trying to integrate LightBox in a virtual expo. I am using the theme Berlin. I’ve already looked this http://omeka.org/codex/Adding_LightBox_to_Omeka. The problem is that I can’t find in the berlin/items/show.php file the line item_image_gallery in order to modify this, so it doesn’t work for me.

Could you help me further?

Looks like a gap in the documentation – indeed, the Berlin theme doesn’t seem to use that function. The closest analogy is probably the line

<?php echo files_for_item(); ?>

It might work to replace that with

<?php echo item_image_gallery(); ?>

then make the changes from the documentation, though I haven’t tried it myself.

I too am using Berlin, when I follow the directions the follow error message appears (see below). It looks like it’s trying to find the lightbox.min.css in the libraries folder not the theme folder. Any ideas?

InvalidArgumentException
Could not find file css/lightbox.min.css!
exception ‘InvalidArgumentException’ with message ‘Could not find file css/lightbox.min.css!’ in /home/pkp3/akkadian.yctl.org/application/libraries/globals.php:1279
Stack trace:indent preformatted text by 4 spaces
exception ‘InvalidArgumentException’ with message ‘Could not find file css/lightbox.min.css!’ in /home/pkp3/akkadian.yctl.org/application/libraries/globals.php:1279
Stack trace:
0 /home/pkp3/akkadian.yctl.org/application/libraries/globals.php(1238): web_path_to(‘css/lightbox.mi…’)
1 /home/pkp3/akkadian.yctl.org/application/libraries/globals.php(1186): src(‘lightbox.min’, ‘css’, ‘css’)
2 /home/pkp3/akkadian.yctl.org/application/libraries/globals.php(1087): css_src(‘lightbox.min’, ‘css’)
3 /home/pkp3/akkadian.yctl.org/themes/berlin/items/show.php(1): queue_css_file(‘lightbox.min’, ‘lightbox/css’)
4 /home/pkp3/akkadian.yctl.org/application/libraries/Omeka/View.php(117): include(’/home/pkp3/akka…’)
5 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run(’/home/pkp3/akka…’)
6 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render(‘items/show.php’)
7 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript(‘items/show.php’, NULL)
8 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render()
9 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
10 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
11 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch(‘showAction’)
12 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
13 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
14 /home/pkp3/akkadian.yctl.org/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
15 /home/pkp3/akkadian.yctl.org/application/libraries/Omeka/Application.php(79): Zend_Application->run()
16 /home/pkp3/akkadian.yctl.org/index.php(23): Omeka_Application->run()
17 {main}

Sorry, it looks like there was a small error in the instructions.

Instead of this line:

<?php queue_css_file('lightbox.min', 'lightbox/css'); ?>

it should be this one:

<?php queue_css_file('lightbox.min', 'all', false, 'lightbox/css'); ?>

I’ve updated the directions, but it should work correctly if you make that change.

To extend this conversation a bit further, I have changed my items/show.php file to display my pdf files in a DocsViewer, so the code is a bit murky as to where I would substitute this piece of code:

<div class="element-text"><?php echo item_image_gallery(array('link'=>array('data-lightbox'=>'lightbox'))); ?></div>

I must also add that I am not using the item-gallery feature and am simply having my images display full-size on the item page. Here is an example of how my images display. I am displaying the original file as my archive is mostly for our alums, many not terribly tech-savvy, so the easier I can make it for them to navigate, the better.

So here is the code that calls for pdfs to be displayed in the DocsViewer and images to be fullsize:

<h1><?php echo metadata('item', array('Dublin Core', 'Title')); ?></h1>
    <div id="primary">
    <?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; ?>
        <!-- disply pdfs in Docs Viewer only - if the file is not a pdf it can be displayed in plugins as normal -->
    <?php if (!$item) $item = get_current_record('item'); $files = $item->Files; foreach($files as $file) if($file->getExtension() !='pdf')?>
    <?php echo get_specific_plugin_hook_output('DocsViewer', 'public_items_show', array('view' => $this, 'item' => $item));
?>
    <?php echo get_specific_plugin_hook_output('Commenting', 'public_items_show', array('view' => $this, 'item' => $item));
?>
    </div>

Any suggestions as to how I can incorporate the lightbox for my images?

Thanks,
Nancy

Hi Nancy, I was just thinking through a similar problem to update a related thread. I just implemented LightBox and I realized that it was messing up my PDFs.

My solution was just to add a condition that only used LightBox for JPG or GIF files (check out that thread for the code). It looks like your code above already restricts the DocsViewer to PDFs. Just extend that if/else/then logic based on file extensions to open certain images with LightBox. Use the directions at https://omeka.org/codex/Adding_LightBox_to_Omeka as your other starting point, of course.

2 posts were split to a new topic: Images not working in Universal Viewer