budabing103 Posted May 2, 2007 Share Posted May 2, 2007 I got this script from a third party. Its supposed to play all the .jpg in a folder in a .swf but instead plays everything (.jpg) in the root directory. <?php function readFiles($aPath, &$aFiles) { $dir_handle = @opendir($aPath) or die(""); while($file = readdir($dir_handle)) { $fullpath = $aPath.$file; if(is_dir($fullpath) == false) { $ext = substr($file, -4); if($file[0] != '.' && (strtolower($ext) == '.jpg')) { $aFiles[] = $fullpath; } } } closedir($dir_handle); } function files2str($aFiles) { $cnt = count($aFiles); $ret = "files="; for($i=0; $i<$cnt; $i++) { $ret = $ret.urlencode($aFiles[$i]); if($i<$cnt-1) $ret = $ret."|"; } return $ret; } $files = array(); $l = strlen($img_path); if($l <= 0) { $img_path = "./"; } else { if($img_path[$l - 1] != '/') $img_path = $img_path."/"; } @readFiles($img_path, $files); echo files2str($files); ?> if i play with any of the settings in the quotes in this line (line 39) i get no pics played. what should this read? $img_path = "./"; i have no clue what i'm doing but i'll learn Quote Link to comment https://forums.phpfreaks.com/topic/49733-newbie-needs-help-with-probably-simple-problem/ Share on other sites More sharing options...
budabing103 Posted May 3, 2007 Author Share Posted May 3, 2007 I don't see an edit option so I'll reply with more info here. This little program works properly when put in its own dierctory with the page that the gallery is supposed to be in, but its supposed to work from the root directory, I think. When in the root directory the page that is calling this up is populated by every jpg in the root directory, instead of the /img forder its supposed to. but when in its own directory it works. Any help appreciated, I'm brand new to PHP. Here is a copy of the code inserted into the body of the html page that is supposed to have the gallery <div style="position: relative; width: 400px; height: 300px; overflow:hidden"> <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="2000" HEIGHT="2000" id="flashslide" ALIGN=""> <PARAM NAME=movie VALUE="flashslide.swf?src=flash-here.com&imglist_fn=getimglist.php&img_path=img&interval=3000&navbar=1&w=400&h=300"> <PARAM NAME=quality VALUE=high> <PARAM NAME=scale VALUE=noscale> <PARAM NAME=wmode VALUE=transparent> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="flashslide.swf?src=flash-here.com&imglist_fn=getimglist.php&img_path=img&interval=3000&navbar=1&w=400&h=300" quality=high scale=noscale wmode=transparent bgcolor=#FFFFFF WIDTH="2000" HEIGHT="2000" NAME="flashslide" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT> the page name of the code posted in the original post is /getimglist.php and this little bit of code is as far as i can tell calling getimglist.php to populate flashslide.swf with the .jpg files in the folder /img. What am I missing here? Quote Link to comment https://forums.phpfreaks.com/topic/49733-newbie-needs-help-with-probably-simple-problem/#findComment-244081 Share on other sites More sharing options...
chinclub Posted May 9, 2007 Share Posted May 9, 2007 try changing $img_path = "./"; to $img_path = "/home/username/public_html/img/"; your path to your directories will look different from that depending on your host, but you get the idea. Quote Link to comment https://forums.phpfreaks.com/topic/49733-newbie-needs-help-with-probably-simple-problem/#findComment-248979 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.