it still doesn´t work.

If i echo $retVal i just get the word 'Array' (the same number of times that
the number of files in the directory).

If i echo $file i get the file listing...however, it doesn´t pass on the
content to the rest of my script.

Maybe someone could help me out with the whole script? I downloaded this
from some script archive and it works if i use the datafile. But
i don´t want to change that file every time a new photo is uploaded.
I am trying to read the directory and use the directory handle listing

If anyone wants to help me out making this databasedriven instead youre very
welcome :)


        $retVal = array ();
    //Load Directory Into Array
        while (false !== ($file = readdir($handle)))

        if ($file != "." && $file != ".." && ereg(".jpg",$file)) {

        $retVal [count($retVal)] = $file;

        echo "$retVal <br>\n";


    //initialize variables
    //$data_file = "";
    $thumbnail_dir = "thumbs/";
    $num_rows = 3;
    $photos_per_row = 3;
    $photos = file($retVal);  //$retVal used to be $data_file
    $total_photos = sizeof($photos);
    $photos_per_page = $num_rows * $photos_per_row;
    //check to see if the start variable exists in the URL.
    //If not, then the user is on the first page - set start to 0
        $start = 0;
    //init i to where it needs to start in the photos array
    $i = $start;
    $prev_start = $start - $photos_per_page;
    $next_start = $start + $photos_per_page;

for ($row=0; $row < $num_rows; $row++){
  for ($col=0; $col < $photos_per_row; $col++){
      if($i < $total_photos){
        $thumbnail = $thumbnail_dir.trim($photos[$i]);
        $thumb_image_size = getimagesize($thumbnail);
        $image_size = getimagesize(trim($photos[$i]));
        print("<td align=\"center\">
,'".$image_size[0]."','".$image_size[1]."');\"><img src=\"".$thumbnail."\"
".$thumb_image_size[3]." border=\"0\"></a></td>\n");
      } else {

        //Clean up directory array
        return $retVal;

//end table

> -----Original Message-----
> From: _lallous [mailto:[EMAIL PROTECTED]]
> Sent: den 18 september 2001 13:46
> Subject: [PHP] Re: Replacing datafile with array
> works like a charm....
> just initializet the $retVal function...
> $retVal = array();
> rest of script here....

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to