budabing103 Posted April 9, 2007 Share Posted April 9, 2007 PHP noob here. I am trying to get a php script to load images out of a folder on my site to a .swf movie. I have the whole thing working exept that it just loads all the .jpg's on the whole site. I got this script from a flash site that doesn't aid PHP. Script is named getimglist.php and is as follows <?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_list."/"; } @readFiles($img_path, $files); echo files2str($files); ?> in particular if i change if($l <= 0) { $img_path = "./"; } in any way I get no photos loaded. Otherwise if I leave it I get all the photos on the whole site. Please help I don't know how this phrase is supposed to be written but I am pretty sure it shouldn't be the way it is. Link to comment https://forums.phpfreaks.com/topic/46306-php-noob-cant-get-php-script-to-load-the-right-picture-in-my-swf/ Share on other sites More sharing options...
budabing103 Posted April 9, 2007 Author Share Posted April 9, 2007 One more thing, I don't think its my HTML but here it is just incase someone needs it to help me out. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>DiversiTech Photos</title> </head> <body text="#ffffff" vLink="#FFFFFF" aLink="#FFFFFF" link="#FFFFFF" bgColor="#000000"> <DIV align=center> <TABLE borderColor=#ffffff cellSpacing=0 cellPadding=0 width=784 border=1> <TBODY> <TR> <TD vAlign=top align=middle width=780> <TABLE cellSpacing=0 cellPadding=0 width=780 border=0> <TBODY> <TR> <TD width=780> <img border="0" src="Site%20Pics/rocks.jpg" width="780" height="125"></TD></TR> <TR> <TD width=780> <img border="0" src="logo1.gif" width="780" height="48"></TD></TR></TBODY></TABLE> <TABLE cellSpacing=0 cellPadding=0 width=780 border=0> <TBODY> <TR> <TD vAlign=top align=middle width="29%" height=295> <!--[if gte IE 6]><script language="javascript">document.write("<NOSCRIPT class=clickfix><OBJECT style=\"display:none\">"); </script> <!--<![endif]--> <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="239" height="295"> <param name="movie" value="Buttons.swf"> <param name="quality" value="High"> <embed src="Buttons.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="239" height="295" quality="High"> </object> <!--[if gte IE 6]></OBJECT></NOSCRIPT><!--<![endif]--> </TD> <TD vAlign=top align=middle width="69%" bgColor=#000000 height=295> <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=Photos&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=Photos&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> </div> </TD></TR></TBODY></TABLE> <TABLE cellSpacing=0 cellPadding=0 width=780 border=0> <TBODY> <TR> <TD width=239 height=150> <p align="center"> <img border="0" src="Site%20Pics/DiversiTech%20Logo%20color-glow.jpg" width="237" height="209"></TD> <TD vAlign=center align=middle bgColor=#000000 height=105><B><FONT color=white> <img border="0" src="Site%20Pics/photos.jpg" width="360" height="90"></FONT></B></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE> <TABLE cellSpacing=4 cellPadding=0 width=780 border=0> <TBODY> <TR> <TD align=middle width=780> <font face="Arial"> <span style="font-size: 9pt"><a href="Home%20Page.htm">Home</a> | <a href="About%20Us%20Page.htm">About Us</a> | <a href="Products%20Page.htm">Products</a> | <a href="Where%20To%20Buy%20Page.htm">Where to Buy</a> | <a href="Contact%20Us%20Page.htm">Contact Us</a> | <a href="Photos%20Page.htm">Photos</a></span></font></TD></TR></TBODY></TABLE></DIV> <script language="JScript" type="text/jscript" src="/ClickFix.js"></script> </body> </html> Link to comment https://forums.phpfreaks.com/topic/46306-php-noob-cant-get-php-script-to-load-the-right-picture-in-my-swf/#findComment-225293 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.