I have the following code to retrieve and display a list of jpg images in a directory (displayed in a table)
I want to check each image if it has a reference in a database, would this be very slow to do with a loop, and if so, would using an array be the answer?
Could anyone give me a few pointers on the code?
Thanks
My code Below:
<table width="435" height="325" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="147" bgcolor="#E2E2E2">nother image</td>
<td width="288">
<?
$jcthumbs = "../contacts/".$_SESSION['jcglobal']."/thumbnails";
$jcimages = "../contacts/".$_SESSION['jcglobal']."/images";
$dir = opendir($jcthumbs);
?>
<table border="1" cellpadding="3" cellspacing="10" bordercolor="#FF0000"><tr>
<?
$IC = 0;
while ($file = readdir($dir)){
if ( eregi(".jpg$","$file")){
$IC++;
if ($IC == 1){ print ("<tr>\n"); }
print ("<td><img src=$jcthumbs\$file>\n");
print ("<a href=\"$jcimages\$file\">$file</a>\n");
// if (blah = "ha") {
// $myImgSelect = "<input name="Selected" type="checkbox" value="" checked>";
// }
// else { $myImgSelect = "<input name="Selected" type="checkbox" value="" checked>";
print ("<input type=\"checkbox\" name=\"Selection\" value=\"picname\">\n");
print ("</td>");
if ($IC >= 4){ print ("</tr>\n"); $IC = 0; }
}
}
?>
</tr></table>