slideshow.php, slideshow.css and slideshow-controls.png need to be present in the theme folder."); $plugin_author = "Malte Müller (acrylian), Stephen Billard (sbillard), Don Peterson (dpeterson)"; $plugin_version = '1.1.1'; $plugin_URL = "http://www.zenphoto.org/documentation/plugins/_plugins---slideshow.php.html"; $option_interface = new slideshowOptions(); /** * Plugin option handling class * */ class slideshowOptions { function slideshowOptions() { //setOptionDefault('slideshow_size', '595'); setOptionDefault('slideshow_width', '595'); setOptionDefault('slideshow_height', '595'); setOptionDefault('slideshow_watermark', ''); setOptionDefault('slideshow_mode', 'jQuery'); setOptionDefault('slideshow_effect', 'fade'); setOptionDefault('slideshow_speed', '500'); setOptionDefault('slideshow_timeout', '3000'); setOptionDefault('slideshow_showdesc', ''); // incase the flowplayer has not been enabled!!! setOptionDefault('slideshow_flow_player_width', '640'); setOptionDefault('slideshow_flow_player_height', '480'); } function getOptionsSupported() { return array( gettext('Slide width') => array('key' => 'slideshow_width', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Width of the images in the slideshow. [jQuery mode option]
If empty the theme options image size is used.")), gettext('Slide height') => array('key' => 'slideshow_height', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Height of the images in the slideshow. [jQuery mode option]
If empty the theme options image size is used.")), gettext('Watermark') => array('key' => 'slideshow_watermark', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext("Check if you want to use your watermark on the images [jQuery mode option].")), gettext('Mode') => array('key' => 'slideshow_mode', 'type' => OPTION_TYPE_SELECTOR, 'selections' => array(gettext("jQuery")=>"jQuery", gettext("flash")=>"flash"), 'desc' => gettext("jQuery for JS ajax slideshow, flash for flash based slideshow.)")), gettext('Effect') => array('key' => 'slideshow_effect', 'type' => OPTION_TYPE_SELECTOR, 'selections' => array(gettext('fade')=>"fade", gettext('shuffle')=>"shuffle", gettext('zoom')=>"zoom", gettext('slide X')=>"slideX", gettext('slide Y')=>"slideY", gettext('scroll up')=>"scrollUp", gettext('scroll down')=>"scrollDown", gettext('scroll left')=>"scrollLeft", gettext('scroll right')=>"scrollRight"), 'desc' => gettext("The cycle slide effect to be used. [jQuery mode option]")), gettext('Speed') => array('key' => 'slideshow_speed', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Speed of the transition in milliseconds.")), gettext('Timeout') => array('key' => 'slideshow_timeout', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Milliseconds between slide transitions (0 to disable auto advance.) [jQuery mode option]")), gettext('Description') => array('key' => 'slideshow_showdesc', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext("Check if you want to show the image's description below the slideshow [jQuery mode option].")), gettext('flow player width') => array('key' => 'slideshow_flow_player_width', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Width of the Flowplayer display for the slideshow (Flash mode).")), gettext('flow player height') => array('key' => 'slideshow_flow_player_height', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Height of the Flowplayer display for the slideshow (Flash mode).")) ); } function handleOption($option, $currentValue) { } } $slideshow_instance = 0; /** * Prints a link to call the slideshow (not shown if there are no images in the album) * To be used on album.php and image.php * A CSS id names 'slideshowlink' is attached to the link so it can be directly styled. * * @param string $linktext Text for the link */ function printSlideShowLink($linktext='') { global $_zp_current_image, $_zp_current_album, $_zp_current_search, $slideshow_instance; if (checkForPassword(true)) return; if(empty($_GET['page'])) { $pagenr = 1; } else { $pagenr = $_GET['page']; } $slideshowhidden = ''; if (in_context(ZP_SEARCH)) { $imagenumber = ''; $imagefile = ''; $albumnr = 0; $slideshowlink = rewrite_path("/page/slideshow","index.php?p=slideshow"); $slideshowhidden = ''; } else { if(in_context(ZP_IMAGE)) { $imagenumber = imageNumber(); $imagefile = $_zp_current_image->filename; } else { $imagenumber = ""; $imagefile = ""; } if (in_context(ZP_SEARCH_LINKED)) { $albumnr = -getAlbumID(); } else { $albumnr = getAlbumID(); } $slideshowlink = rewrite_path(pathurlencode($_zp_current_album->getFolder())."/page/slideshow","index.php?p=slideshow&album=".urlencode($_zp_current_album->getFolder())); } $numberofimages = getNumImages(); if($numberofimages != 0) { ?>
filename; $ext = getSuffix($image); if (in_array($ext, $valid_types)) { return $ext; } return false; } /** * Prints the slideshow using the jQuery plugin Cycle (http://http://www.malsup.com/jquery/cycle/) * or Flash based using Flowplayer 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. * Them 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. * * @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. * * */ function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "") { if (!isset($_POST['albumid']) AND !is_object($albumobj)) { echo "

".gettext("Invalid linking to the slideshow page.")."

"; echo ""; exit(); } global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery; //getting the image to start with if(!empty($_POST['imagenumber']) AND !is_object($imageobj)) { $imagenumber = ($_POST['imagenumber']-1); // slideshows starts with 0, but zp with 1. } elseif (is_object($imageobj)) { makeImageCurrent($imageobj); $imagenumber = (imageNumber()-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 = 0; } // getting the number of images if(!empty($_POST['numberofimages'])) { $numberofimages = sanitize_numeric($_POST['numberofimages']); } elseif (is_object($albumobj)) { $numberofimages = $albumobj->getNumImages(); } //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"); } $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 = $_POST['preserve_search_params']; $search->setSearchParams($params); $images = $search->getImages(0); $searchwords = $search->words; $searchdate = $search->dates; $searchfields = $search->fields; $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(!checkAlbumPassword($albumq['folder'], $hint)) { 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($_POST['imagefile']).getOption('mod_rewrite_image_suffix'),'/index.php?album='.urlencode($album->name).'&image='.urlencode($_POST['imagefile'])); } } // slideshow display section switch($option) { case "jQuery": $validtypes = array('jpg','jpeg','gif','png','mov','3gp'); ?>
'; // 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:
"; } if(!is_object($albumobj)) { // disable controls if calling the slideshow directly on homepage for example ?>
"> "> ">
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.getAlbumFolder('').pathurlencode($folder)."/".urlencode($filename); } else { $folder = $album->name; $filename = $images[$idx]; //$filename = $animage; $image = newImage($album, $filename); $imagepath = FULLWEBPATH.getAlbumFolder('').pathurlencode($folder)."/".urlencode($filename); } $ext = is_valid($filename, $validtypes); if ($ext) { $imgnr++; echo "

".$albumtitle.gettext(":")." ".$image->getTitle()." (". ($idx + 1) ."/".$numberofimages.")

"; if ($ext == "3gp") { echo ' '; } elseif ($ext == "mov") { echo ' '; } else { makeImageCurrent($image); printCustomSizedImageMaxSpace($alt='',$width,$height,NULL,NULL,false); //echo "".html_encode($image->getTitle())."\n"; } if(getOption("slideshow_showdesc")) { $desc = $image->getDesc(); $desc = str_replace("\r\n", '
', $desc); $desc = str_replace("\r", '
', $desc); echo "

".$desc."

"; } echo "
"; } } break; case "flash": if ($heading) { echo "

".$albumtitle." (".$numberofimages." images) | ".gettext("back")."

"; } echo ""; ?> "; echo "

"; printf (gettext("Click on %s on the right in the player control bar to view full size."), ""); echo "

"; break; } ?>