Jump to content

craigtb

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.rarrr.com

Profile Information

  • Gender
    Not Telling

craigtb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok that got it working but its still adding the extra dead image. So what i am trying is to say is that if it exists put the picture but if it doesnt put . But i think somehtign is wrong with my file_exists() because its saying none of them exist. Here is my code. <html> <head> <title></title> </head> <body> <font color="FFFFFF"> <center> <?php $numcols = 4; $count = 0; $num = 1; echo "<table><tr>"; while ($count <= 55) { if ($count % $numcols == 0) { echo "</tr>"; echo "<tr>\n"; echo "<td>"; if (file_exists('pages/gallery$num.jpg')) { echo "<a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; } else { echo " "; } echo "</td>"; $count++; $num++; } else { echo "<td>"; if (file_exists('pages/gallery$num.jpg')) { echo "<a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; } else { echo " "; } echo "</td>"; $count++; $num++; } } ?></tr></table></center></font> </body> </html>
  2. Nah its still giving me the same error.
  3. I am totally trying to rewrite this and am getting some errors that i can not figure out. it is saying Parse error: syntax error, unexpected $end on like 37, which is the last line of the file. here is the complete file. <html> <head> <title></title> </head> <body> <font color="FFFFFF"> <center> <?php $numcols = 4; $count = 0; $num = 1; echo "<table><tr>"; while ($count <= 55) { if ($count % $numcols == 0) { echo "</tr>"; echo "<tr>\n"; echo "<td>"; echo "<a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; echo "</td>"; $count++; $num++; } elseif ($count % $numcols != 0) { echo "<td>"; echo "<a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; echo "</td>; $count++; $num++; } } ?></tr></table></center></font> </body> </html> any help would be great, thanks.
  4. well that fixed that problem but it is still showing dead images. Does anyone know why?
  5. Ok scratch that last post, i found lots of errors. Now it is working but instead of cycling through all the pictures it just continually shows image 1 for every place. here is the code now define ("NUMCOLS",4); $count = 0; $num = 1; echo "<TABLE border=1>"; $newarray = 1; while ($count <= 55) { if ($count % NUMCOLS == 0) echo "<TR>\n"; # new row echo "<TD>"; print "\t<td><a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; echo "</TD>\n"; $count++; if ($count % NUMCOLS == 0) echo "</TR>\n"; # end row } if ($count % NUMCOLS != 0) { # end row if not already ended while ($count++ % NUMCOLS) echo "<td> </td>"; echo "</TR>\n"; $newarray++; ++$num; } echo "</TABLE>";[\code]
  6. should this work a little better? define ("NUMCOLS",4); $count = 0; echo "<TABLE border=1>"; while ($newarray >= 55) { if ($count % NUMCOLS == 0) echo "<TR>\n"; # new row echo "<TD>"; print "\t<td><a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; echo "</TD>\n"; $count++; if ($count % NUMCOLS == 0) echo "</TR>\n"; # end row } if ($count % NUMCOLS != 0) { # end row if not already ended while ($count++ % NUMCOLS) echo "<td> </td>"; echo "</TR>\n"; $newarray++; } echo "</TABLE>";
  7. Yes i did mean ==. But that is all the PHP i have in the file, the rest is just general html
  8. whoops i meant to have define ("NUMCOLS",2); $count = 0; echo "<TABLE border=1>"; while ($newarray = 55) { if ($count % NUMCOLS == 0) echo "<TR>\n"; # new row echo "<TD>"; print "\t<td><a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; echo "</TD>\n"; $count++; if ($count % NUMCOLS == 0) echo "</TR>\n"; # end row } if ($count % NUMCOLS != 0) { # end row if not already ended while ($count++ % NUMCOLS) echo "<td> </td>"; echo "</TR>\n"; } echo "</TABLE>";
  9. Alright i looked at that and it seems pretty similar to something i've done before. This is what i have now. while ($newarray = 55) { if ($count % NUMCOLS == 0) echo "<TR>\n"; # new row echo "<TD>"; print "\t<td><a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; echo "</TD>\n"; $count++; if ($count % NUMCOLS == 0) echo "</TR>\n"; # end row } if ($count % NUMCOLS != 0) { # end row if not already ended while ($count++ % NUMCOLS) echo "<td> </td>"; echo "</TR>\n"; } echo "</TABLE>"; But whenever i run it, it freezes up firefox, which makes me belive that it actually has no limits and jsut continues through the loop forever. Also what does show up is that its just one column. Any suggestions?
  10. Ok i tested it and the file_exists function does work with a random file. And i am not sure about the <td></td>, the other file seems to work without it.
  11. Yea i think you understand it, but when i tried using that it wont display anything now. It is very likely i placed it in the wrong place. Any advice? <?php $num = 1; print "<table border=\"0\">\n"; for ($y = 1; $y <= 15; $y++) { print "<tr>\n"; for ($x=1; $x<=4; $x++) { if(file_exists('pages/gallery/$num.jpg')){ //print the image print "\t<td><a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; } ++$num; } print "</tr>\n"; } print "</table>"; ?>
  12. Hello, I have a picture gallery that will automatically add pictures if they have the right name and all i have to do is add rows to my loop. Right now i have it so there are four thumbnails per row. The problem is that when the number is not divisible by 4 evenly it will still add pictures in a number that is evenly divisible by four but they will just be dead images. How would i go about making if there is not a number of pictures that is even divisible by four to make it not add the extra dead images. here is the code. <?php $num = 1; print "<table border=\"0\">\n"; for ($y = 1; $y <= 15; $y++) { print "<tr>\n"; for ($x=1; $x<=4; $x++) { print "\t<td><a href=\"pages/gallery/$num.jpg\" ><img border=\"0\" src=\"pages/gallery/thumb_$num.jpg\" alt=\"$num\" title=\"$num\" width=\"100\" height=\"90\"></a>"; ++$num; } print "</tr>\n"; } print "</table>"; ?> I know what i have said might be a little confusing, and i am sorry for that. thanks in advance, Craig
  13. Ok, cool thanks, i'll try and implement it. And if anyone is wondering the blue lines are because i forgot to put the border="0" anywho thanks for the help!
  14. Ahh, sorry. But how do i validate that they are on my server? Sorry I am not to knowledgeable on this topic.
  15. Ok, that code you supplied worked, but i have used it the other way and it used to work. How would i go about making it more secure? And does anybody know how to get rid of the blue lines that go around the images/links? I only have it up on a local server so i cant exactly show it to you, sorry.
×
×
  • 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.