readdir() and files with numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm having a really weird problem. My code works, unless the images start with a number, then I get a 500 error. If they start with a letter it's fine. 

some example of problem files:
178_image.jpg
0005396C.jpg

the whole reason I wrote this code was so that I wouldn't have to rename all my files to pic1, pic2, etc...

What I find truely crazy, is that I can rename "178_image.jpg" to "a178_image.jpg" and everything is fine.  How can I work with file names that start with numbers?

**********************************************************************
// the thumbnail page (new card and new paragraph)
echo( "<card id='thumbs'>\n" );
echo( "<p>\n" );

// $path is the gender group (lesbian, gays, etc...)
// $group is the model group (matt, rick, nurses, etc...)

if ($handle = opendir("galleries/$path/$group/pics/thumb/")) 
{
   $b=0;
   while (false !== ($file[$b] = readdir($handle))) 
   {
       $b++;
   }
   closedir($handle);
}

// Create the thumbnail table
// The table should be 3x3
echo( "<table columns='3'>\n");

// $a is the counter w/ values 1-9
// $i is row number w/ values 1-3
// $j is column number w/ valuse 1-3
// $q is the counter for the files read from the thumbnail directory

$q=0;
for( $i=1, $a=1; $i<=3; $i++)
{
 echo( "<tr>\n");
 for( $j=1; $j<=3; $a++, $j++)
 {
  if($file[$q]=="." || $file[$q]=="..")
  {
   $q++;
  }
  echo( "<td><a href='#$file[$q]'><img src='galleries/$path/$group/pics/thumb/$file[$q]' alt='thumb$a'/></a></td>\n");
  $q++;
 }
 echo( "</tr>\n");
}
// End the table
echo( "</table>\n");

// End the paragraph and card
echo( "</p>\n" );
echo( "</card>\n" );

// Loop creating 9 cards for the pics 
for( $x=1, $q=0; $x<=9; $q++, $x++)
{
 
 if($file[$q]=="." || $file[$q]=="..")
 {
  $q++;
 }

 // the thumbnail page (new card and new paragraph)
 echo( "<card id='$file[$q]'>\n" );
 echo( "<p>\n" );
 

 echo( "<img src=\"galleries/$path/$group/pics/$file[$q]\" alt='pic$x'/>\n"); 

 // End the paragraph and card
 echo( "</p>\n" );
 echo( "</card>\n" );
************************************************************

Andrew Darrow
Kronos1 Productions
www.pudlz.com


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux