Jump to content

[SOLVED] Stinkin' Pictures


phpretard

Recommended Posts

full code (working):

<?php
$galleryarray = array();
$galleryarray[0]="P1120081.jpg"; 
$galleryarray[1]="P1120082.jpg"; 
$galleryarray[2]="P1120083.jpg"; 
$galleryarray[3]="P1120084.jpg"; 
$galleryarray[4]="P1120085.jpg"; 
$galleryarray[5]="P1120086.jpg";

foreach ($galleryarray as $ga) {
echo "<img src='".$ga.">\n";
}
?> 

I appologize for not showing the rest of the script.

 

Here it is.

 

while($row = mysql_fetch_array($result))

  {
  $lastname=$row['lastname'];
  $firstname=$row['firstname'];
  
  echo $firstname ." ". $lastname;
  
  }

function returnimages($dirname="ALBUMS/$lastname") {

   $pattern="\.(jpg|jpeg|png|gif|bmp)$";
   
   $files = array();
   
   $curimage=0;
   
   if($handle = opendir($dirname)) {
   
       while(false !== ($file = readdir($handle))){
       
               if(eregi($pattern, $file)){

                 echo '<br>galleryarray[' . $curimage .']=["' . $file . '"];' . "<br>";
                 $curimage++;

               }
       }

       closedir($handle);
   }
   return($files);
}

returnimages();


 

Where should I put the code you provided?


$dirname = "ALBUMS/".$lastname;
function returnimages($dirname)

Somehow it produced this:

 

Warning: Missing argument 1 for returnimages(), called in /home/content/r/e/m/rememberthe/html/pages/photos_get.php on line 47 and defined in /home/content/r/e/m/rememberthe/html/pages/photos_get.php on line 17

 

I did get the pictures to finaly display...now the only problem is defining the path with the code above.

<?php
while($row = mysql_fetch_array($result))

  {
  $lastname=$row['lastname'];
  $firstname=$row['firstname'];
  
  echo $firstname ." ". $lastname;
  
  }
$dirname = "ALBUMS/".$lastname;
function returnimages($dirname) {
$galleryarray = array();
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
	while(false !== ($file = readdir($handle))){
		if(eregi($pattern, $file)){
			$galleryarray[$curimage]=$file;
			$curimage++;
		}
	}
	closedir($handle);
}
return($files);
}

returnimages();
?>

re-worked, but without having the full code, I can't promise it will work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.