"; ################################################################################ ################################################################################ // PHPSlideShow v0.6 written by Greg Lawler // from http://www.zinkwazi.com/pages.php?page_name=scripts // v0.6.1 july 2002 - fixed special character bug. // v0.6 july 2002 - added lots of formatting options and a security patch // v0.5.1 march 2002 - minor bug fixes, reg exp fix... // v0.5 march 2002 - osx path fix, page headings for multi dir, cleaner... // v0.4 july 10 2001 // v0.3.5 july 5 2001 // v0.3.4 april 19 2001 // v0.3.3 january 9 2001 // v0.3.1 september 29 2000 - added support for image buttons // v0.3 september 12 2000 - added support for comments // v0.2 august 28 2000 // // Feel free to use/modify this little script // // IMPORTANT NOTE.... // if you want to send me a token of appreciation, starbucks coffee coupons // are gladly accepted from http://www.starbucks.com ;) // my address is: // attention: greg lawler // 801 alston road, santa barbara, ca 93108 usa // otherwise it's free. // // this script comes with no implied warranty. // // enjoy :) // greg ############################# Quick Start Installation ######################### // put this file in a directory that contains your images // the slideshow should now work... ############################# Customized Installation ######################### // Q: how do i add image comments/descriptions to the slideshow? // A: make a file (e.g. pics.txt) that contains the image names and descriptions // place each image name and description on a new line separated by a semi colon. // an easy way to do this is type // ls *.jpg > pics.txt in linux or // dir *.jpg > pics.txt in dos - you will need edit this with notepad/vi to clean // out any extra stuff that dir puts in there and to add the semi colon and // description. // the slideshow should now work including comments... // // Q: how do i give each directory of images it's own page heading? // A: place a file called heading.txt in each directory. place the page heading // on the first line of this file. // // Q: how do i use one slideshow for multiple different directories of images? // A: all you need to do to enable this is to call the script and pass it the // directory path. // NOTE: for security, you can only access directories within the same level as // the phpslideshow.php script... // eg http://your_url/phpslideshow.php?directory=dog_pics // eg http://your_url/phpslideshow.php?directory=cat_pics // eg http://your_url/phpslideshow.php?directory=extra/cat_pics // these three examples will run phpslideshow but each one will load a different // set of images and descriptions located in the directories shown // // Q: how do i use phpslideshow.php in my existing web page or html template? // A: change the $standalone variable from true to false. // what this does is removes the html page headers and footers and only prints // out the phpslideshow table... // to use this in an existing php page, use the following line: // include("phpslideshow.php"); // don't forget that this is php code so it needs to be inside the ERROR: Your request contains an invalid path.
"; print "For security purposes, you can only access directories "; print "within this one.
"; print "Your dir path may not contain .. or : or start with a /
"; print "
Try again"; exit; } // set directory $directory == "../public/foto"; if (empty($directory)) $directory = "."; // if there is no $heading_info_file (see format above) set page heading here if ( !file_exists("$directory/$heading_info_file")) { $header = "Foto"; $browser_title = "$header"; } else { $heading_info = file("$directory/$heading_info_file"); $header = htmlentities($heading_info[0]); } // image / text buttons if ($show_navigation_buttons == "true") { $back_src = "\"$back_alt\""; $next_src = "\"$next_alt\""; } else { $back_src = "$back_alt"; $next_src = "$next_alt"; } if ( !file_exists("$directory/$pic_info_file")) { $dh = opendir( "$directory" ); while( $file = readdir( $dh ) ) { // look for these file types.... if (eregi("(jpg|jpeg|gif|png)$",$file)) { $pic_info[] = $file; sort( $pic_info ); } } } else $pic_info=file("$directory/$pic_info_file"); // begin messing with the array $number_pics = count ($pic_info); if (empty($currentPic)) $currentPic = 0; if (($currentPic > $number_pics)||($currentPic == $number_pics)) $currentPic = '0'; $item = explode (";", $pic_info[$currentPic]); $last = $number_pics - 1; $next = $currentPic + 1; if ($currentPic > 0 ) $back = $currentPic - 1; else $currentPic = "0"; // print the description if it exists $blank = empty($item[1])?' ':htmlentities($item[1]); $show_name = ($show_image_name=="false")?' ':htmlentities($item[0]); if ($currentPic > 0 ) $nav=$back; else $nav=$last; // meta refresh stuff for auto slideshow... if ($auto_slideshow == "true") { $meta_refresh = ""; } else $meta_refresh = "\n"; ################################################################################ // top of html page stuff // print the page header if in standalone mode if ($standalone == "true") { print <<< HERE $meta_refresh $header HERE; } // draw the main table in html print <<< HERE
  $header $back_src [ $next of $number_pics ] $next_src  
image $blank
$show_name
   $home_link
HERE; // print the page footer if in standalone mode if ($standalone == "true") { print <<< HERE HERE; } ?>