Welcome Guest, Not a member yet? Register   Sign In
unwanted item in image gallery
#1

[eluser]learning_php[/eluser]
Hi,

I have written a basic image gallery but it loads a thumbs.db file which is located in the thumbs folder. How do I define which types of file to display?

Code:
<?php

$images = "thumbs/"; # Location of small versions
$big = "uploads/";
$cols   = 5; # Number of columns to display

if ($handle = opendir($images)) {
   while (false !== ($file = readdir($handle))) {
       if ($file != "." && $file != ".." ) {
           $files[] = $file;
       }
   }
   closedir($handle);
}

$colCtr = 0;

echo '<table width="100%" cellspacing="0"><tr>';

foreach($files as $file)
{
  if($colCtr %$cols == 0)
    echo '</tr><tr><td colspan="5"><hr /></td></tr><tr>';
  echo '<td align="center"><a href="'. $big . $file . '"><img src="' . $images . $file . '" /></a></td>';
  $colCtr++;
}

echo '</table>' . "\r\n";

?&gt;


Messages In This Thread
unwanted item in image gallery - by El Forum - 05-03-2009, 01:24 PM
unwanted item in image gallery - by El Forum - 05-03-2009, 01:45 PM
unwanted item in image gallery - by El Forum - 05-03-2009, 01:49 PM
unwanted item in image gallery - by El Forum - 05-03-2009, 01:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB