Photo Gallery Code.
This code is show all the images from the images folder with filename ending with "_thumb"
When i run this code its working but i a getting an error as "Notice: Undefined variable: count in C:\wamp\www\photogallery\AutoGeneratingGallery\index.php on line 58"
I am using Wamp server 2.0 Please some help me to solve this issue.
<?php
/* settings */
$image_dir = 'images/';
$per_column = 5;
/* step one: read directory, make array of files */
if ($handle = opendir($image_dir)) {
while (false !== ($file = readdir($handle)))
{
if ($file != '.' && $file != '..')
{
if(strstr($file,'-thumb'))
{
$files[] = $file;
}
}
}
closedir($handle);
}
/* step two: loop through, format gallery */
if(count($files))
{
$count++;
foreach($files as $file)
{
echo '<a class="photo-link" rel="one-big-group" href="',$image_dir,str_replace('-thumb','',$file),'"><img src="',$image_dir, $file,'" width="100" height="100" /></a>';
if($count % $per_column == 4)
{
echo '<div class="clear"></div>';
}
}
}
else
{
echo '<p>There are no images in this gallery.</p>';
}
?>