Ejemplo n.º 1
0
        ?>
</a> |
										<?php 
    }
    printGalleryTitle();
    ?>
</a> |
									<?php 
    if (is_null($_zp_current_album)) {
        $search = new SearchEngine();
        $params = trim(zp_getCookie('zenphoto_search_params'));
        $search->setSearchParams($params);
        $images = $search->getImages(0);
        $searchwords = $search->getSearchWords();
        $searchdate = $search->getSearchDate();
        $searchfields = $search->getSearchFields(true);
        $page = $search->page;
        $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
        echo '<a href=' . html_encode($returnpath) . '><em>' . gettext('Search') . '</em></a> | ';
    } else {
        printParentBreadcrumb();
        printAlbumBreadcrumb("", " | ");
    }
    ?>
 </span>
								Slideshow
							</div> <!-- navbar -->
						</div> <!-- wrapnav -->
					</div> <!-- galleryheader -->
				</div> <!-- main2 -->
				<div id="content">
Ejemplo n.º 2
0
 /**
  * Prints the slideshow using the {@link http://http://www.malsup.com/jquery/cycle/  jQuery plugin Cycle}
  *
  * Two ways to use:
  * a) Use on your theme's slideshow.php page and called via printSlideShowLink():
  * If called from image.php it starts with that image, called from album.php it starts with the first image (jQuery only)
  * To be used on slideshow.php only and called from album.php or image.php.
  *
  * b) Calling directly via printSlideShow() function (jQuery mode)
  * Place the printSlideShow() function where you want the slideshow to appear and set create an album object for $albumobj and if needed an image object for $imageobj.
  * The controls are disabled automatically.
  *
  * NOTE: The jQuery mode does not support movie and audio files anymore. If you need to show them please use the Flash mode.
  * Also note that this function is not used for the Colorbox mode!
  *
  * @param bool $heading set to true (default) to emit the slideshow breadcrumbs in flash mode
  * @param bool $speedctl controls whether an option box for controlling transition speed is displayed
  * @param obj $albumobj The object of the album to show the slideshow of. If set this overrides the POST data of the printSlideShowLink()
  * @param obj $imageobj The object of the image to start the slideshow with. If set this overrides the POST data of the printSlideShowLink(). If not set the slideshow starts with the first image of the album.
  * @param int $width The width of the images (jQuery mode). If set this overrides the size the slideshow_width plugin option that otherwise is used.
  * @param int $height The heigth of the images (jQuery mode). If set this overrides the size the slideshow_height plugin option that otherwise is used.
  * @param bool $crop Set to true if you want images cropped width x height (jQuery mode only)
  * @param bool $shuffle Set to true if you want random (shuffled) order
  * @param bool $linkslides Set to true if you want the slides to be linked to their image pages (jQuery mode only)
  * @param bool $controls Set to true (default) if you want the slideshow controls to be shown (might require theme CSS changes if calling outside the slideshow.php page) (jQuery mode only)
  *
  */
 function printSlideShow($heading = true, $speedctl = false, $albumobj = NULL, $imageobj = NULL, $width = NULL, $height = NULL, $crop = false, $shuffle = false, $linkslides = false, $controls = true)
 {
     global $_myFavorites, $_zp_conf_vars;
     if (!isset($_POST['albumid']) and !is_object($albumobj)) {
         return '<div class="errorbox" id="message"><h2>' . gettext('Invalid linking to the slideshow page.') . '</h2></div>';
     }
     //getting the image to start with
     if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
         $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
         // slideshows starts with 0, but zp with 1.
     } elseif (is_object($imageobj)) {
         $imagenumber = $imageobj->getIndex();
     } else {
         $imagenumber = 0;
     }
     // set pagenumber to 0 if not called via POST link
     if (isset($_POST['pagenr'])) {
         $pagenumber = sanitize_numeric($_POST['pagenr']);
     } else {
         $pagenumber = 1;
     }
     // getting the number of images
     if (!empty($_POST['numberofimages'])) {
         $numberofimages = sanitize_numeric($_POST['numberofimages']);
     } elseif (is_object($albumobj)) {
         $numberofimages = $albumobj->getNumImages();
     } else {
         $numberofimages = 0;
     }
     if ($imagenumber < 2 || $imagenumber > $numberofimages) {
         $imagenumber = 0;
     }
     //getting the album to show
     if (!empty($_POST['albumid']) && !is_object($albumobj)) {
         $albumid = sanitize_numeric($_POST['albumid']);
     } elseif (is_object($albumobj)) {
         $albumid = $albumobj->getID();
     } else {
         $albumid = 0;
     }
     if (isset($_POST['preserve_search_params'])) {
         // search page
         $search = new SearchEngine();
         $params = sanitize($_POST['preserve_search_params']);
         $search->setSearchParams($params);
         $searchwords = $search->getSearchWords();
         $searchdate = $search->getSearchDate();
         $searchfields = $search->getSearchFields(true);
         $page = $search->page;
         $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
         $albumobj = new AlbumBase(NULL, false);
         $albumobj->setTitle(gettext('Search'));
         $albumobj->images = $search->getImages(0);
     } else {
         if (isset($_POST['favorites_page'])) {
             $albumobj = $_myFavorites;
             $returnpath = $_myFavorites->getLink($pagenumber);
         } else {
             $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
             $albumobj = newAlbum($albumq['folder']);
             if (empty($_POST['imagenumber'])) {
                 $returnpath = $albumobj->getLink($pagenumber);
             } else {
                 $image = newImage($albumobj, sanitize($_POST['imagefile']));
                 $returnpath = $image->getLink();
             }
         }
     }
     echo slideshow::getShow($heading, $speedctl, $albumobj, $imageobj, $width, $height, $crop, $shuffle, $linkslides, $controls, $returnpath, $imagenumber);
 }
Ejemplo n.º 3
0
function printBaseSlideShow()
{
    global $_zp_gallery, $_zp_gallery_page, $_myFavorites, $_zp_conf_vars, $_zp_themeroot, $isMobile, $isTablet;
    if (!isset($_POST['albumid'])) {
        return '<div class="errorbox" id="message"><h2>' . gettext('Invalid linking to the slideshow page.') . '</h2></div>';
    }
    //getting the image to start with
    if (!empty($_POST['imagenumber'])) {
        $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
        // slideshows starts with 0, but zp with 1.
    } else {
        $imagenumber = 0;
    }
    // set pagenumber to 0 if not called via POST link
    if (isset($_POST['pagenr'])) {
        $pagenumber = sanitize_numeric($_POST['pagenr']);
    } else {
        $pagenumber = 1;
    }
    // getting the number of images
    if (!empty($_POST['numberofimages'])) {
        $numberofimages = sanitize_numeric($_POST['numberofimages']);
    } else {
        $numberofimages = 0;
    }
    //if ($imagenumber < 2 || $imagenumber > $numberofimages) {
    //	$imagenumber = 0;
    //}
    //getting the album to show
    if (!empty($_POST['albumid'])) {
        $albumid = sanitize_numeric($_POST['albumid']);
    } else {
        $albumid = 0;
    }
    if (isset($_POST['preserve_search_params'])) {
        // search page
        $search = new SearchEngine();
        $params = sanitize($_POST['preserve_search_params']);
        $search->setSearchParams($params);
        $searchwords = $search->getSearchWords();
        $searchdate = $search->getSearchDate();
        $searchfields = $search->getSearchFields(true);
        $page = $search->page;
        $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
        $albumobj = new AlbumBase(NULL, false);
        $albumobj->setTitle(gettext('Search'));
        $albumobj->images = $search->getImages(0);
        $albumtitle = gettext('Search');
    } else {
        if (isset($_POST['favorites_page'])) {
            $albumobj = $_myFavorites;
            $returnpath = rewrite_path($_myFavorites->getLink() . '/' . $pagenumber, FULLWEBPATH . '/index.php?p=favorites' . '&page=' . $pagenumber);
            $albumtitle = gettext('Favorites');
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $albumobj = newAlbum($albumq['folder']);
            $albumtitle = $albumobj->getTitle();
            if (empty($_POST['imagenumber'])) {
                $returnpath = $albumobj->getLink($pagenumber);
            } else {
                $image = newImage($albumobj, sanitize($_POST['imagefile']));
                $returnpath = $image->getLink();
            }
        }
    }
    if (!$albumobj->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumobj)) {
        return '<div class="errorbox" id="message"><h2>' . gettext('This album is password protected!') . '</h2></div>';
    }
    $slideshow = '';
    $numberofimages = $albumobj->getNumImages();
    if ($numberofimages == 0) {
        return '<div class="errorbox" id="message"><h2>' . gettext('No images for the slideshow!') . '</h2></div>';
    }
    $images = $albumobj->getImages(0);
    // slideshow generate data for galleria
    ?>
		<script>
			var data = [
			<?php 
    for ($c = 0, $idx = 0; $c < $numberofimages; $c++, $idx++) {
        if (is_array($images[$idx])) {
            $filename = $images[$idx]['filename'];
            $album = newAlbum($images[$idx]['folder']);
            $image = newImage($album, $filename);
        } else {
            $filename = $images[$idx];
            $image = newImage($albumobj, $filename);
        }
        if (isImagePhoto($image)) {
            makeImageCurrent($image);
            echo '{' . "\n";
            echo 'thumb: \'' . getImageThumb() . '\',' . "\n";
            echo 'image: \'' . getDefaultSizedImage() . '\',' . "\n";
            echo 'big: \'' . getCustomImageURL(getOption('zpbase_galbigsize')) . '\',' . "\n";
            echo 'title: \'' . js_encode($image->getTitle()) . '\',' . "\n";
            $desc = $image->getDesc();
            $desc = str_replace("\r\n", '<br />', $desc);
            $desc = str_replace("\r", '<br />', $desc);
            echo 'description: \'' . js_encode($desc) . '\',' . "\n";
            if (!getOption('zpbase_nodetailpage')) {
                echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n";
            }
            if ($c == $numberofimages - 1) {
                echo '}' . "\n";
            } else {
                echo '},' . "\n";
            }
        } else {
            if ($imagenumber > 0 && $imagenumber > $c) {
                $imagenumber--;
            }
        }
    }
    echo "\n";
    ?>
			];
		</script>
		<?php 
    $sspage = true;
    require_once 'inc/galleria-jscall.php';
}
Ejemplo n.º 4
0
/**
 * Prints the Galleria slideshow for albums or search results.
 *
 * Two ways to use (see readme/documentation):
 * a) Used on the included theme slideshow.php page and called via printSlideShowLink() from the core slideshow plugin:
 * b) Calling directly via printGslideshow() function in a template file or codeblock.
 *
 * @param obj $albumobj The object of the album to show the slideshow of. Not needed if calling slideshow from album, image, or search.
 * @param obj $imageobj The object of the image to start the slideshow with. If not set the slideshow starts with the first image of the album, or current image if called from image.php. Not needed if calling slideshow from album, image, or search.
 * @param bool $linkslides Set to true if you want the slides to be linked to their image pages
 * @param mixed $autoplay true to autoplay slideshow with interval set in options, false to start with slideshow stopped.  Set integer in milliseconds to autoplay at that interval (Ex. 4000), overriding plugin option set.
 * @param bool $shuffle Set to true if you want random (shuffled) order of the slides
 *
 * */
function printGslideshow($albumobj = null, $imageobj = null, $linkslides = true, $autoplay = true, $forceheight = false, $shuffle = false)
{
    $data = 'data';
    // no POST data from slidehow link and $albumobj provided is not valid, exit
    if (!isset($_POST['albumid']) and !is_object($albumobj)) {
        echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
        echo "</div></body></html>";
        exitZP();
    }
    global $_zp_current_image, $_zp_current_album, $_zp_gallery, $_myFavorites, $_zp_conf_vars;
    $imagenumber = 0;
    //getting the image to start with
    if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
        $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
        // slideshows starts with 0, but zp with 1.
    } elseif (is_object($imageobj)) {
        makeImageCurrent($imageobj);
        $imagenumber = imageNumber() - 1;
    }
    // set pagenumber to 0 if not called via POST link
    if (isset($_POST['pagenr'])) {
        $pagenumber = sanitize_numeric($_POST['pagenr']);
    } else {
        $pagenumber = 1;
    }
    // getting the number of images
    if (!empty($_POST['numberofimages'])) {
        $numberofimages = sanitize_numeric($_POST['numberofimages']);
    } elseif (is_object($albumobj)) {
        $numberofimages = $albumobj->getNumImages();
    } else {
        $numberofimages = 0;
    }
    if ($imagenumber < 2 || $imagenumber > $numberofimages) {
        $imagenumber = 0;
    }
    //getting the album to show
    if (!empty($_POST['albumid']) && !is_object($albumobj)) {
        $albumid = sanitize_numeric($_POST['albumid']);
        $embedded = false;
    } elseif (is_object($albumobj)) {
        $albumid = $albumobj->getID();
        $embedded = true;
    } else {
        $albumid = 0;
        $embedded = false;
    }
    if ($numberofimages == 0) {
        return NULL;
    }
    // get slideshow data
    if (isset($_POST['preserve_search_params'])) {
        // search page
        $search = new SearchEngine();
        $params = sanitize($_POST['preserve_search_params']);
        $search->setSearchParams($params);
        $images = $search->getImages(0);
        $searchwords = $search->getSearchWords();
        $searchdate = $search->getSearchDate();
        $searchfields = $search->getSearchFields(true);
        $page = $search->page;
        $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
        $albumtitle = gettext('Search');
    } else {
        if (isset($_POST['favorites_page'])) {
            $album = $_myFavorites;
            $albumtitle = gettext('My Favorites');
            $images = $album->getImages(0);
            $returnpath = rewrite_path(favorites::getFavorites_link() . '/' . $pagenumber, FULLWEBPATH . '/index.php?p=favorites' . '&page=' . $pagenumber);
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $album = newAlbum($albumq['folder']);
            $albumtitle = $album->getTitle();
            if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumq['folder'])) {
                echo gettext("This album is password protected!");
                exitZP();
            }
            $dynamic = $album->isDynamic();
            $images = $album->getImages(0);
            // return path to get back to the page we called the slideshow from
            if (empty($_POST['imagenumber'])) {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
            } else {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode(sanitize($_POST['imagefile'])) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
            }
        }
    }
    if ($shuffle) {
        shuffle($images);
    }
    // slideshow display section
    ?>

			<script>
				var data = [
				<?php 
    for ($imgnr = 0, $cntr = 0, $idx = 0; $imgnr < $numberofimages; $imgnr++, $idx++) {
        if (is_array($images[$idx])) {
            $filename = $images[$idx]['filename'];
            $album = newAlbum($images[$idx]['folder']);
            $image = newImage($album, $filename);
        } else {
            $filename = $images[$idx];
            $image = newImage($album, $filename);
        }
        $ext = isImagePhoto($image);
        if ($ext) {
            makeImageCurrent($image);
            echo '{' . "\n";
            echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n";
            echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n";
            echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n";
            echo 'title: \'' . js_encode($image->getTitle()) . '\',' . "\n";
            $desc = $image->getDesc();
            $desc = str_replace("\r\n", '<br />', $desc);
            $desc = str_replace("\r", '<br />', $desc);
            echo 'description: \'' . js_encode($desc) . '\',' . "\n";
            if ($linkslides) {
                echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n";
            }
            if ($imgnr == $numberofimages - 1) {
                echo '}' . "\n";
            } else {
                echo '},' . "\n";
            }
        }
    }
    echo "\n";
    ?>
				];
			</script>
			<?php 
    printGalleriaRun($data, $linkslides, $autoplay, $embedded, $forceheight, $imagenumber, $albumtitle, $returnpath);
    //restore_context(); // needed if the slideshow is for example called directly via album object before the next_album loop on index.php
}
Ejemplo n.º 5
0
/**
 * Prints the slideshow using the jQuery plugin Cycle (http://http://www.malsup.com/jquery/cycle/)
 * or Flash based using Flowplayer3 http://flowplayer.org if installed
 *
 * Two ways to use:
 * a) Use on your theme's slideshow.php page and called via printSlideShowLink():
 * If called from image.php it starts with that image, called from album.php it starts with the first image (jQuery only)
 * To be used on slideshow.php only and called from album.php or image.php.
 *
 * b) Calling directly via printSlideShow() function (jQuery mode recommended)
 * Call printSlideShowJS() function in the head section of the theme page you want to use the slideshow on.
 * Then place the printSlideShow() function where you want the slideshow to appear and set $albumobj and if needed $imageobj.
 * The controls are disabled automatically.
 *
 * NOTE: The jQuery mode does not support movie and audio files anymore. If you need to show them please use the Flash mode.
 * Also note that this function is not used for the Colorbox mode!
 *
 * @param bool $heading set to true (default) to emit the slideshow breadcrumbs in flash mode
 * @param bool $speedctl controls whether an option box for controlling transition speed is displayed
 * @param obj $albumobj The object of the album to show the slideshow of. If set this overrides the POST data of the printSlideShowLink()
 * @param obj $imageobj The object of the image to start the slideshow with. If set this overrides the POST data of the printSlideShowLink(). If not set the slideshow starts with the first image of the album.
 * @param int $width The width of the images (jQuery mode). If set this overrides the size the slideshow_width plugin option that otherwise is used.
 * @param int $height The heigth of the images (jQuery mode). If set this overrides the size the slideshow_height plugin option that otherwise is used.
 * @param bool $crop Set to true if you want images cropped width x height (jQuery mode only)
 * @param bool $shuffle Set to true if you want random (shuffled) order
 * */
function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "", $crop = false, $shuffle = false)
{
    if (!isset($_POST['albumid']) and !is_object($albumobj)) {
        echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
        echo "</div></body></html>";
        exit;
    }
    global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery;
    $imagenumber = 0;
    //getting the image to start with
    if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
        $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
        // slideshows starts with 0, but zp with 1.
    } elseif (is_object($imageobj)) {
        makeImageCurrent($imageobj);
        $imagenumber = imageNumber() - 1;
    }
    // set pagenumber to 0 if not called via POST link
    if (isset($_POST['pagenr'])) {
        $pagenumber = sanitize_numeric($_POST['pagenr']);
    } else {
        $pagenumber = 0;
    }
    // getting the number of images
    if (!empty($_POST['numberofimages'])) {
        $numberofimages = sanitize_numeric($_POST['numberofimages']);
    } elseif (is_object($albumobj)) {
        $numberofimages = $albumobj->getNumImages();
    } else {
        $numberofimages = 0;
    }
    if ($imagenumber < 2 || $imagenumber > $numberofimages) {
        $imagenumber = 0;
    }
    //getting the album to show
    if (!empty($_POST['albumid']) and !is_object($albumobj)) {
        $albumid = sanitize_numeric($_POST['albumid']);
    } elseif (is_object($albumobj)) {
        $albumid = $albumobj->id;
    } else {
        $albumid = -1;
    }
    // setting the image size
    if (!empty($width) and !empty($height)) {
        $width = sanitize_numeric($width);
        $height = sanitize_numeric($height);
    } else {
        $width = getOption("slideshow_width");
        $height = getOption("slideshow_height");
    }
    if ($numberofimages == 0) {
        return NULL;
    }
    $option = getOption("slideshow_mode");
    // jQuery Cycle slideshow config
    // get slideshow data
    $gallery = new Gallery();
    if ($albumid <= 0) {
        // search page
        $dynamic = 2;
        $search = new SearchEngine();
        $params = sanitize($_POST['preserve_search_params']);
        $search->setSearchParams($params);
        $images = $search->getImages(0);
        $searchwords = $search->words;
        $searchdate = $search->dates;
        $searchfields = $search->getSearchFields(true);
        $page = $search->page;
        if (empty($_POST['imagenumber'])) {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . abs($albumid));
            $album = new Album($gallery, $albumq['folder']);
            $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
            //$returnpath = rewrite_path('/'.pathurlencode($album->name).'/page/'.$pagenumber,'/index.php?album='.urlencode($album->name).'&page='.$pagenumber);
        } else {
            $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
        }
        $albumtitle = gettext('Search');
    } else {
        $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
        $album = new Album($gallery, $albumq['folder']);
        $albumtitle = $album->getTitle();
        if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumq['folder'])) {
            echo gettext("This album is password protected!");
            exit;
        }
        $dynamic = $album->isDynamic();
        $images = $album->getImages(0);
        // return path to get back to the page we called the slideshow from
        if (empty($_POST['imagenumber'])) {
            $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
        } else {
            $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode(sanitize($_POST['imagefile'])) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
        }
    }
    if ($shuffle) {
        shuffle($images);
    }
    $showdesc = getOption("slideshow_showdesc");
    // slideshow display section
    switch ($option) {
        case "jQuery":
            $validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
            ?>
			<script type="text/javascript">
				// <!-- <![CDATA[
				$(document).ready(function(){
					$(function() {
						var ThisGallery = '<?php 
            echo html_encode($albumtitle);
            ?>
';
						var ImageList = new Array();
						var TitleList = new Array();
						var DescList = new Array();
						var ImageNameList = new Array();
						var DynTime=(<?php 
            echo getOption("slideshow_timeout");
            ?>
) * 1.0;	// force numeric
						<?php 
            for ($imgnr = 0, $cntr = 0, $idx = $imagenumber; $imgnr < $numberofimages; $imgnr++, $idx++) {
                if ($dynamic) {
                    $filename = $images[$idx]['filename'];
                    $album = new Album($gallery, $images[$idx]['folder']);
                    $image = newImage($album, $filename);
                } else {
                    $filename = $images[$idx];
                    $image = newImage($album, $filename);
                }
                $ext = is_valid($filename, $validtypes);
                if ($ext) {
                    makeImageCurrent($image);
                    if ($crop) {
                        $img = getCustomImageURL(NULL, $width, $height, $width, $height);
                    } else {
                        $img = getCustomSizedImageMaxSpace($width, $height);
                    }
                    //$img = WEBPATH . '/' . ZENFOLDER . '/i.php?a=' . pathurlencode($image->album->name) . '&i=' . pathurlencode($filename) . '&s=' . $imagesize;
                    echo 'ImageList[' . $cntr . '] = "' . $img . '";' . "\n";
                    echo 'TitleList[' . $cntr . '] = "' . js_encode($image->getTitle()) . '";' . "\n";
                    if ($showdesc) {
                        $desc = $image->getDesc();
                        $desc = str_replace("\r\n", '<br />', $desc);
                        $desc = str_replace("\r", '<br />', $desc);
                        echo 'DescList[' . $cntr . '] = "' . js_encode($desc) . '";' . "\n";
                    } else {
                        echo 'DescList[' . $cntr . '] = "";' . "\n";
                    }
                    if ($idx == $numberofimages - 1) {
                        $idx = -1;
                    }
                    echo 'ImageNameList[' . $cntr . '] = "' . urlencode($filename) . '";' . "\n";
                    $cntr++;
                }
            }
            echo "\n";
            $numberofimages = $cntr;
            ?>
						var countOffset = <?php 
            echo $imagenumber;
            ?>
;
						var totalSlideCount = <?php 
            echo $numberofimages;
            ?>
;
						var currentslide = 2;

						function onBefore(curr, next, opts) {
							if (opts.timeout != DynTime) {
								opts.timeout = DynTime;
							}
							if (!opts.addSlide)
								return;

							var currentImageNum = currentslide;
							currentslide++;
							if (currentImageNum == totalSlideCount) {
								opts.addSlide = null;
								return;
							}
							var relativeSlot = (currentslide + countOffset) % totalSlideCount;
							if (relativeSlot == 0) {relativeSlot = totalSlideCount;}
							var htmlblock = "<span class='slideimage'><h4><strong>" + ThisGallery + ":</strong> ";
							htmlblock += TitleList[currentImageNum]  + " (" + relativeSlot + "/" + totalSlideCount + ")</h4>";
							htmlblock += "<img src='" + ImageList[currentImageNum] + "'/>";
							htmlblock += "<p class='imgdesc'>" + DescList[currentImageNum] + "</p></span>";
							opts.addSlide(htmlblock);
						}

						function onAfter(curr, next, opts){
							<?php 
            if (!$album->isMyItem(LIST_RIGHTS)) {
                ?>
							//Only register at hit count the first time the image is viewed.
							if ($(next).attr( 'viewed') != 1) {
								$.get("<?php 
                echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
                ?>
/slideshow/slideshow-counter.php?album=<?php 
                echo pathurlencode($album->name);
                ?>
&img="+ImageNameList[opts.currSlide]);
								$(next).attr( 'viewed', 1 );
							}
							<?php 
            }
            ?>
						}

						$('#slides').cycle({
								fx:     '<?php 
            echo getOption("slideshow_effect");
            ?>
',
								speed:   <?php 
            echo getOption("slideshow_speed");
            ?>
,
								timeout: DynTime,
								next:   '#next',
								prev:   '#prev',
								cleartype: 1,
								before: onBefore,
								after: onAfter
						});

						$('#speed').change(function () {
							DynTime = this.value;
							return false;
						});

						$('#pause').click(function() { $('#slides').cycle('pause'); return false; });
						$('#play').click(function() { $('#slides').cycle('resume'); return false; });
					});

				});	// Documentready()
				// ]]> -->
			</script>
				<div id="slideshow" align="center">
				<?php 
            // 7/21/08dp
            if ($speedctl) {
                echo '<div id="speedcontrol">';
                // just to keep it away from controls for sake of this demo
                $minto = getOption("slideshow_speed");
                while ($minto % 500 != 0) {
                    $minto += 100;
                    if ($minto > 10000) {
                        break;
                    }
                    // emergency bailout!
                }
                $dflttimeout = getOption("slideshow_timeout");
                /* don't let min timeout = speed */
                $thistimeout = $minto == getOption("slideshow_speed") ? $minto + 250 : $minto;
                echo 'Select Speed: <select id="speed" name="speed">';
                while ($thistimeout <= 60000) {
                    // "around" 1 minute :)
                    echo "<option value={$thistimeout} " . ($thistimeout == $dflttimeout ? " selected='selected'>" : ">") . round($thistimeout / 1000, 1) . " sec</option>";
                    /* put back timeout to even increments of .5 */
                    if ($thistimeout % 500 != 0) {
                        $thistimeout -= 250;
                    }
                    $thistimeout += $thistimeout < 1000 ? 500 : ($thistimeout < 10000 ? 1000 : 5000);
                }
                echo "</select> </div>";
            }
            if (!is_object($albumobj)) {
                // disable controls if calling the slideshow directly on homepage for example
                ?>
				<div id="controls">
				<div><span><a href="#" id="prev"
					title="<?php 
                echo gettext("Previous");
                ?>
"></a></span> <a
					href="<?php 
                echo html_encode($returnpath);
                ?>
" id="stop"
					title="<?php 
                echo gettext("Stop and return to album or image page");
                ?>
"></a>
				<a href="#" id="pause"
					title="<?php 
                echo gettext("Pause (to stop the slideshow without returning)");
                ?>
"></a>
				<a href="#" id="play" title="<?php 
                echo gettext("Play");
                ?>
"></a> <a
					href="#" id="next" title="<?php 
                echo gettext("Next");
                ?>
"></a>
				</div>
				</div>
				<?php 
            }
            ?>
				<div id="slides" class="pics">
				<?php 
            if ($cntr > 1) {
                $cntr = 1;
            }
            for ($imgnr = 0, $idx = $imagenumber; $imgnr <= $cntr; $idx++) {
                if ($idx >= $numberofimages) {
                    $idx = 0;
                }
                if ($dynamic) {
                    $folder = $images[$idx]['folder'];
                    $dalbum = new Album($gallery, $folder);
                    $filename = $images[$idx]['filename'];
                    $image = newImage($dalbum, $filename);
                    $imagepath = FULLWEBPATH . ALBUM_FOLDER_EMPTY . pathurlencode($folder) . "/" . urlencode($filename);
                } else {
                    $folder = $album->name;
                    $filename = $images[$idx];
                    //$filename = $animage;
                    $image = newImage($album, $filename);
                    $imagepath = FULLWEBPATH . ALBUM_FOLDER_EMPTY . pathurlencode($folder) . "/" . urlencode($filename);
                }
                $ext = is_valid($filename, $validtypes);
                if ($ext) {
                    $imgnr++;
                    echo "<span class='slideimage'><h4><strong>" . $albumtitle . gettext(":") . "</strong> " . $image->getTitle() . " (" . ($idx + 1) . "/" . $numberofimages . ")</h4>";
                    if ($ext == "3gp") {
                        echo '</a>
										<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="352" height="304" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
										<param name="src" value="' . $imagepath . '"/>
										<param name="autoplay" value="false" />
										<param name="type" value="video/quicktime" />
										<param name="controller" value="true" />
										<embed src="' . $imagepath . '" width="352" height="304" autoplay="false" controller"true" type="video/quicktime"
										pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed>
										</object>
										<a>';
                    } elseif ($ext == "mov") {
                        echo '</a>
										<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="640" height="496" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
										<param name="src" value="' . $imagepath . '"/>
										<param name="autoplay" value="false" />
										<param name="type" value="video/quicktime" />
										<param name="controller" value="true" />
										<embed src="' . $imagepath . '" width="640" height="496" autoplay="false" controller"true" type="video/quicktime"
										pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed>
										</object>
										<a>';
                    } else {
                        makeImageCurrent($image);
                        if ($crop) {
                            printCustomSizedImage('', NULL, $width, $height, $width, $height, NULL, NULL, NULL, NULL, false);
                        } else {
                            printCustomSizedImageMaxSpace($alt = '', $width, $height, NULL, NULL, false);
                        }
                        //echo "<img src='".WEBPATH."/".ZENFOLDER."/i.php?a=".pathurlencode($folder)."&i=".urlencode($filename)."&s=".$imagesize."' alt='".html_encode($image->getTitle())."' title='".html_encode($image->getTitle())."' />\n";
                    }
                    if ($showdesc) {
                        $desc = $image->getDesc();
                        $desc = str_replace("\r\n", '<br />', $desc);
                        $desc = str_replace("\r", '<br />', $desc);
                        echo "<p class='imgdesc'>" . $desc . "</p>";
                    }
                    echo "</span>";
                }
            }
            break;
        case "flash":
            if ($heading) {
                echo "<span class='slideimage'><h4><strong>" . $albumtitle . "</strong> (" . $numberofimages . " images) | <a style='color: white' href='" . html_encode($returnpath) . "' title='" . gettext("back") . "'>" . gettext("back") . "</a></h4>";
            }
            echo "<span id='slideshow' style='display: block; margin: 0 auto; width:" . getOption('slideshow_flow_player_width') . "px; height: " . getOption('slideshow_flow_player_height') . "px'></span>";
            $curdir = getcwd();
            chdir(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/flowplayer3');
            $filelist = safe_glob('flowplayer-*.swf');
            $swf = array_shift($filelist);
            $filelist = safe_glob('flowplayer.controls-*.swf');
            $controls = array_shift($filelist);
            chdir($curdir);
            ?>
			<script type="text/javascript">
			// <!-- <![CDATA[
			flowplayer('slideshow','<?php 
            echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
            ?>
/flowplayer3/<?php 
            echo $swf;
            ?>
', {

			clip: {
					onLastSecond: function() {
					this.getScreen().animate({opacity: 0}, <?php 
            echo getOption('slideshow_speed') / 2;
            ?>
);
					},
					onFinish: function(){
					this.getScreen().animate({opacity: 1}, 1000);
					},
					onStart: function() {
					this.getScreen().animate({opacity: 1}, <?php 
            echo getOption('slideshow_speed') / 2;
            ?>
);
					}
						},

			playlist: [
			<?php 
            echo "\n";
            $count = 0;
            foreach ($images as $animage) {
                if ($dynamic) {
                    $folder = $animage['folder'];
                    $filename = $animage['filename'];
                    $salbum = new Album($_zp_gallery, $folder);
                    $image = newImage($salbum, $filename);
                    $imagepath = FULLWEBPATH . ALBUM_FOLDER_EMPTY . pathurlencode($salbum->name) . "/" . urlencode($filename);
                } else {
                    $folder = $album->name;
                    $filename = $animage;
                    $image = newImage($album, $filename);
                    $imagepath = FULLWEBPATH . ALBUM_FOLDER_EMPTY . pathurlencode($folder) . "/" . pathurlencode($filename);
                }
                $ext = is_valid($filename, array('jpg', 'jpeg', 'gif', 'png', 'flv', 'mp3', 'mp4'));
                if ($ext) {
                    if ($ext == "flv" || $ext == "mp3" || $ext == "mp4") {
                        $duration = "";
                    } else {
                        $duration = ", duration: " . getOption("slideshow_timeout") / 1000;
                    }
                    if ($count > 0) {
                        echo ",\n";
                    }
                    echo "{ url: '" . FULLWEBPATH . ALBUM_FOLDER_EMPTY . pathurlencode($folder) . "/" . urlencode($filename) . "'" . $duration . ", scaling: 'fit', autoBuffering: true }";
                    $count++;
                }
            }
            echo "\n";
            ?>
		],
		plugins:  {
				controls: {
					url: '<?php 
            echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
            ?>
/flowplayer3/<?php 
            echo $controls;
            ?>
',
						playlist: true,
						autoHide: 'always'
				}
		}
										});
			// ]]> -->
		</script>
			<?php 
            echo "</span>";
            echo "<p>";
            echo gettext("Click on the right in the player control bar to view full size.");
            echo "</p>";
            break;
    }
    ?>
	</div>
</div>
	<?php 
    restore_context();
    // needed if the slideshow is for example called directly via album object before the next_album loop on index.php
}