need help creating custom slideshow
jlhughes
Joined: 2002-06-05
Posts: 81 |
Posted: Mon, 2005-05-02 04:57 |
I have a youth soccer web site where I've written a little app that searches all of the files in gallery's albums and returns an array of urls that match a search string. For instance, all the photos with "richard" in the file name. ( You can see how this works at http://rcubarcelona.org/roster ) I would like some help adapting this to the gallery slideshow so that I can feed the results into a modified version of slideshow.php. Has anyone done anything like this? Here's the code I'm using to gather the images info I want to display. I'm sure this is adapted from something I got from here somewhere. $dir_name = "/****/****/public_html/albums/"; if (!isset($player)) // no name was provided { $player = 'team_group'; } //initialize $i function GetDirArray($sPath,$player,$i) { global $player, $dir_name, $i, $match_list; //Load Directory Into Array $handle=opendir($sPath); while (false !== ($file = readdir($handle))) { $retVal[count($retVal)] = $file; } //Clean up and sort closedir($handle); sort($retVal); //return $retVal; while (list($key, $val) = each($retVal)) { if ($val != "." && $val != "..") { $path = str_replace("//","/",$sPath.$val); //prep for search; make sure no capitalization problems $lc_path = strtolower($path); if ( (strpos($lc_path,$player) != 0) && (strpos($lc_path,'thumb') != 0) ) { // this_match is the complete path to the image file $this_match = explode("/",$path); $file_match = count($this_match)-1; $album_match = count($this_match)-2; $match_list[$i]['imagename']=$this_match[$file_match]; $match_list[$i]['imageurl']= $this_match[$album_match] . "/" . $this_match[$file_match]; //debug aid //echo "$i > & {$match_list[$i]['imageurl']} &{$match_list[$i] ['imagename']}<br>"; $i++; } //RECURSIVE TO TAKE CARE OF DIRECTORIES if (is_dir($sPath.$val)) { GetDirArray($sPath.$val."/",$player,$i); } } } } $i=1; GetDirArray($dir_name, $player,$i); rsort($match_list); $max_pics = count($match_list); if (!isset($start)) //first time through { // 0 is first in array $start=0; if ($max_pics > 9) // more than 9 photos { $stop= 8; } ELSE { // subtract 1 from max_pics to adjust for 0 start $stop = ($max_pics-1); } // end if stop < 9 } // end if first time :D Any help would be greatly appreciated. |
|