Jump to content

Recommended Posts

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 :)

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.