busnut Posted September 28, 2010 Share Posted September 28, 2010 G'day all. I had a function working perfectly on an existing script where by when the user clicks on the image, the image pops up in the lightbox style and underneath the image it would display information about that photo from a text file. However, as i've now got a script that read multiple directories instead of just one directly, I can't get the script to work anymore. Here is what I had originally to read the file: $text = "gallery/gallery.txt"; $fh=fopen($text, "r"); while(!feof($fh)) { $temp = explode("|", $line); $title[$temp[0]] = $temp[1]; $description[$temp[0]] = $temp[2]; $photographer[$temp[0]] = $temp[3]; $line=fgets($fh); unset($temp); } and then this was inserted into the a href clause: <a href=$dir/$file rel=\"lightbox\" title=\"$title[$file] <br> $description[$file] \n © $photographer[$file]\"> and the text file was something like this: filename.jpg|title|description|photographer And this here is the file that it needs to go in somehow - but unless somebody has a better solution, please advise either way. (also, exif data is no good as multiple people will upload, and some have no idea on what to do with exif data. function getDirectory( $path = '.', $level = 0 ){ $ignore = array( 'cgi-bin', '.', '..' ); $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ if( !in_array( $file, $ignore ) ){ if( is_dir( "$path/$file" ) ){ $dir = $path . $file; echo "<p>$file<br>"; $dh1 = @opendir( $dir ); while( false !== ( $image = readdir( $dh1 ) ) ){ if( !in_array( $image, $ignore ) ){ if( !is_dir( "$dir/$image" ) ){ echo "<a href=\"$dir/$image\" rel=\"lightbox\"><img src=\"gallery-thumbnail.php?file=$file/$image\" border=2 style='border-color: #981C1E'></a>\n"; } } } echo "</p>"; $level++; } } } closedir( $dh ); } getDirectory('gallery/'); Any help is greatly appreciated. Thankyou Quote Link to comment Share on other sites More sharing options...
busnut Posted September 29, 2010 Author Share Posted September 29, 2010 Is there anybody with suggestions at all. This is the final part of the gallery script i'm trying to get working without success. After some more playing around, all I get to show now is 'NULL' underneath the photos Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.