Good morning, I tell you a question about code that I can not make work.
Given the large number of digital documents that have the descriptions of my AtoM, I have decided to change imageflow by a JQuery image viewer called lightgallery.
The code is the following:
<?php use_helper('Text') ?>
<?php //INFO: Partial show a default image and link all digitalobject for this informatioobject ?>
<?php $childrens = $resource->getChildren(); ?>
<?php if (sizeof($childrens) > 0 && $childrens[0]->getDigitalObject() != null): ?>
<div class="digital-object-reference row">
       <!--<div class="span2"><?php // image_tag($childrens[0]->getDigitalObject()->getPublicPath(), 'id = dynamic'); ?></div>-->
       <div class="span2"><?php echo image_tag($childrens[0]->getDigitalObjectPublicUrl(), 'id = dynamic'); ?></div>
       <div class="span4">
               <p class="lead">
                       <?php echo $resource->title; ?>
               </p>
               <p>
                       <strong>Número de páginas: </strong><?php echo sizeof($childrens); ?>
               </p>
               <p>Haga clic en la imagen para ver el documento completo.</p>
       </div>
</div>
       <?php $arrayPaginas = "[ \n"; ?>
       <?php foreach ($childrens as $child): ?>
               <?php $arrayPaginas .= "{ \n"; ?>
               <?php $arrayPaginas .= "'src': '".$child->getDigitalObjectPublicUrl()."',"; ?>
               <?php $images = $child->getDigitalObject(); ?>
               Hijos del documento: <?php echo sizeof($images); ?>
               <?php $arrayPaginas .= "'thumb': '".$child->getDigitalObjectPublicUrl()."',"; ?>
               <?php $arrayPaginas .= "'subHtml': '<h4>".esc_entities($child->getDigitalObject()->name, 100)."</h4>'"; ?>
               <?php $arrayPaginas .= "}"; ?>
               <?php $arrayPaginas .= ",\n"; ?>
       <?php endforeach; ?>
       <?php $arrayPaginas = substr($arrayPaginas, 0, -1); ?>
       <?php $arrayPaginas .= "                   ]\n"; ?>
<div class="galeria">
                       <script type="text/javascript">
                               jQuery(document).ready(function(){
                                       jQuery('#dynamic').on('click', function() {
                                               jQuery(this).lightGallery({
                                                       hideControlOnEnd: true,
                                                       loop: false,
                                                       swipeThreshold: 50,
                                                       pager: true,
                                                       closable: false,
                                                       dynamic: true,
                                                       dynamicEl: <?php echo $arrayPaginas; ?>
                                               })
                                       });
                               });
                       </script>
       </div>
<?php endif; ?>
I get the first image of the first digitalobject of the informationobject and show it. This image is what I use to launch the script with the click event.
In the script I will create an array of objects that will be the images of digital objects. Each object has a src key, which contains the copy image of lower quality than the master image; another thumb which is the thumbnail, and a subHTML key that is used as the image title.
My question is how to get the lower quality image and the thumbnail to include in the script given that I do not understand well how the informationobject model relates to digitalobject and how the three images are related: the teacher, the copy and the thumbnail.
A greeting.