Jump to content

[SOLVED] Stinkin' Pictures


phpretard

Recommended Posts

Can someone help me turn this code into pictures?

 


galleryarray[0]=["P1120081.jpg"]; 
galleryarray[1]=["P1120082.jpg"]; 
galleryarray[2]=["P1120083.jpg"]; 
galleryarray[3]=["P1120084.jpg"]; 
galleryarray[4]=["P1120085.jpg"]; 
galleryarray[5]=["P1120086.jpg"]; 


Link to comment
Share on other sites

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";
}
?> 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites


$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.

Link to comment
Share on other sites

<?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.

Link to comment
Share on other sites

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.