/** * Returns image links to use the lightbox slideshow function. * * @param array $resources Resources content * @param string $images Array of images to display * @param array $link_options['slide'] Name of the lightbox slide, 'slide' by default * * @author COil * @since 1.0.0 - 5 feb 07 */ function _light_slide_show($resources, $images, $link_options = array(), $li = false, $link_type) { _addLbRessources(); $link_options = _parse_attributes($link_options); // Lightbox specific $link_options['rel'] = 'lightbox[' . (isset($link_options['slidename']) ? $link_options['slidename'] : 'slide') . ']'; unset($link_options['slidename']); $value = ''; if ($resources) { $title = $link_options['title']; switch ($link_type) { // Image to a slideshow case 'TEXT': $cpt = 1; foreach ($images as $image) { $image['options']['rel'] = $link_options['rel']; $link_options['title'] = isset($image['options']['title']) && $image['options']['title'] ? $image['options']['title'] : $title; $text = $cpt == 1 ? $resources : image_tag(sfConfig::get('sf_lightbox_images_dir') . 'blank.gif', true); $value .= light_image_text($text, $image['image'], $link_options, $image['options']); $cpt++; } break; // Image to a slideshow // Image to a slideshow case 'IMAGE': $cpt = 1; foreach ($images as $image) { $image['options']['rel'] = $link_options['rel']; $link_options['title'] = isset($image['options']['title']) && $image['options']['title'] ? $image['options']['title'] : $title; $thumb = $cpt == 1 ? $resources : sfConfig::get('sf_lightbox_images_dir') . 'blank.gif'; $value .= light_image($thumb, $image['image'], $link_options, $image['options'], $li); $cpt++; } break; // Set of thumb to a slideshow // Set of thumb to a slideshow case 'IMAGES': foreach ($images as $image) { $image['options']['rel'] = $link_options['rel']; $link_options['title'] = isset($image['options']['title']) && $image['options']['title'] ? $image['options']['title'] : $title; $value .= light_image($image['thumbnail'], $image['image'], $link_options, $image['options'], $li); } break; } } return $value; }
<h1>Single images</h1> <hr/> <br/> <h2> » On an image link</h2> <?php $image_options = array('title' => 'Optional caption Image 1.'); // Test light_image echo light_image('http://www.huddletogether.com/projects/lightbox2/images/thumb-1.jpg', 'http://www.huddletogether.com/projects/lightbox2/images/image-1.jpg', $image_options); echo ' '; $image_options = array('title' => 'Optional caption Image 2.'); echo light_image('http://www.huddletogether.com/projects/lightbox2/images/thumb-2.jpg', 'http://www.huddletogether.com/projects/lightbox2/images/image-2.jpg', $image_options); ?> <br/><br/> <h2> » On a standart text link</h2> <?php echo light_image_text('» Click me to see the image !! «', 'http://www.huddletogether.com/projects/lightbox2/images/image-2.jpg');