Jump to content

mockenoff

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mockenoff's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ha, wow, I feel like a fool. That little mix of $icount and $counts was the problem. Well, I mean the only problem after the other ones were worked out. Thanks a lot, guys, I really appreciate it. I think that's all of it, but more problems will likely arise.
  2. Yeah, here we go. [code] //set directories $dir = "./images/gallery/$set"; $th = "./images/gallery/thumbnails/$set"; //description call $info = @fopen("./images/gallery/$set/info.txt", "r"); if ($info) {   while (!feof($info)) {       $descs = fgets($info);       $desc[] = $descs;   }   fclose($info); } print_r ($desc); $test = 0; print "<br>{$desc[$test]}"; //reads files $fd = @opendir($dir);      while (($part = @readdir($fd)) == true) {      clearstatcache();          if ($part != "." && $part != "..") {              $gal[] = $part;          }     } //set loop variables $icount = 0; $counts = 0; $spot = 0; $result = count($gal); if ($result > 3) {     $row = ($result / 3);     $sec = ($result % $row);     $thi = ($result / 3) - ($result % 3);     if ($sec != 0) {         $row = $thi + 1;     }     $col = ($result / $thi); } else {     $row = 1;     $col = $result; } //start table echo "<table width=\"575px\">\n"; //start row count loop while ($spot < $row) {         echo "<tr width=\"575px\">\n";         //start column count loop     while ($icounts < $col) {                 echo "<td width=\"33%\"><center><a href=\"$dir/{$gal[$icount]}\"><img src=\"$th/{$gal[$icount]}\" border=\"0\"></a><br>{$desc[$icount]}</center></td>\n";         echo "$counts and $icount and $result and $row and $col and $sec and $thi and ";         $counts++;         $icount++;             //end column count loop     }         echo "</tr>\n";     echo $spot;     $counts = 0;     $spot++;     //end row count loop } //end img var echo "</table>\n";[/code] And that debugging advice? Holy crap, good thinking. Some how $icount and $count come out as 5 digits numbers, but the other variables come out as I want them. I don't know how, though, since I only set them as 0 mere lines above.
  3. Thanks. Yeah, I just sort of noticed that. Pardon my ignorance, anyways, since I'm probably missing the very obvious answer to what I'm about to ask, but what should I do about it?
  4. Thanks, dude, that got some output, except now it's an infite column of broken img src's. Just a page of [code]<td width="33%"><center><a href="./images/gallery/mobile/"><img src="./images/gallery/thumbnails/mobile/" border="0"></a><br></center></td>[/code] over and over again and nothing else. And I'm pretty sure the opendir works, too, because I made another script that just puts out a page of link pics without comments and not in a table using that.
  5. I get a blank page. Essentially, anything before the while loops like the html header and body tags will show up, but anything in the loops won't.
  6. I'm trying to write a pretty quick and (inherently) dirty image gallery script for my site. I've lost a lot of the PHP zing that I probably never had, but I'm pretty sure this script should work, but it doesn't. Does someone mind telling me why? Also, the $dir directory is full of images, $th with thumbnails of them, and info.txt has descriptions of each picture per line of the text file and I'm not really interested in optimization right now, just getting it to work. Thanks guys. [code] //set directories $dir = "./images/gallery/$set"; $th = "./images/gallery/thumbnails/$set"; //description call $info = @fopen("./images/gallery/$set/info.txt", "r"); if ($info) {   while (!feof($info)) {       $descs = fgets($info);       $desc[] = $descs;   }   fclose($info); } //reads files $fd = @opendir($dir);      while (($part = @readdir($fd)) == true) {      clearstatcache();          if ($part != "." && $part != "..") {              $gal[] = $part;          }     } //set while variables $icount = "0"; $counts = "0"; $spot = "0"; $result = count($gal); if ($result > 3) {     $row = ($result / 3);     $sec = ($result % $row);     $thi = ($result / 3) - ($result % 3);     if ($sec != "0") {         $row = $thi++;     }     $col = ($result / $thi); } else {     $row = "1";     $col = $result; } //start table print "<table width=\"575px\">\n"; //start row count loop while ($spot < $row) {         echo "<tr width=\"575px\">\n";         //start column count loop     while ($icounts < $col) {                 echo "<td width=\"33%\"><center><a href=\"$dir/{$gal[$icount]}\"><img src=\"$th/{$gal[$icount]}\" border=\"0\"></a><br>{$desc[$icount]}</center></td>\n";         $counts = $counts++;         $icount = $icount++;             //end column count loop     }         echo "</tr>\n";     $counts = "0";     $spot = $spot++;     //end row count loop } //end table echo "</table>"; [/code]
×
×
  • 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.