How to display images for delete
<p>I have the following code that deletes the images from a folder but it does not display the images on the page and also whats worse is that it display all folder and files within the given folder.</p>

<p>I only want the images to be deleted not any folders with the given folder name.</p>

<p>my code is:</p>

<pre><code>&lt;?php
$path = "../imagefolder";

if(isset($_POST['file']) &amp;&amp; is_array($_POST['file']))
{
    foreach($_POST['file'] as $file)
    {   
        unlink($path . "/" . $file) or die("Failed to &lt;strong class='highlight'&gt;delete&lt;/strong&gt; file");
    }
    header("location: " . $_SERVER['REQUEST_URI']); //redirect after deleting files so the user can refresh without that resending post info message
}
?&gt;
&lt;form name="form1" method="post"&gt;
&lt;?php

$path = "../imagefolder";
$dir_handle = @opendir($path) or die("Unable to open folder");

while (false !== ($file = readdir($dir_handle))) 
{

if($file == "index.php")
continue;
if($file == ".")
continue;
if($file == "..")
continue;

echo "&lt;input type='CHECKBOX' name='file[]' value='$file'&gt;";
echo "&lt;img src='$file' alt='$file'&gt;&lt;br /&gt;";

}
closedir($dir_handle);

?&gt;
&lt;input type="submit" name="Delete" value="Delete"&gt;
&lt;/form&gt;
</code></pre>

<p>This is the code that displays my gallery </p>

<pre><code>&lt;?php 

        function createLbFromDir ($linkname, $galname, $directory, $thumbdirectory, $extensions = array ('jpg', 'jpeg','png','gif')) {
    $gallery = "";
    $dh = opendir ($directory);
    while ($file = readdir ($dh)) {
        $parts = explode(".", basename ($file));
        $extension = $parts[count($parts)-1];
        if (!is_dir ($directory . $file) &amp;&amp; ($file != ".." &amp;&amp; $file != ".") &amp;&amp; in_array($extension, $extensions)) {
        $gallery.= "&lt;a href="".$directory.$file."" rel="lightbox[".$galname."]"&gt;&lt;img src="".$thumbdirectory.$file."" alt=""&gt;&lt;/a&gt;n";
        }
    }
    return $gallery;
    }

    // Page variables
    $pageTitle = "SAFAAS - Asian Clothes Specialists";  
    $currentPage = "gallery"; 

        require_once("includes/header.php"); 

        require_once("includes/menu.php"); 
?&gt;

&lt;div id="portfolio_content" class="block"&gt;

                          &lt;ul&gt;

                            &lt;?php echo createLbFromDir ("Linkname", "galleryname", "imagefolder/" , "imagefolder/thumbfolder/"); ?&gt;


                          &lt;/ul&gt;

                      &lt;/div&gt;
</code></pre>

<p>The images are displayed for the gallery fine and the gallery works and uses the lightbox slider plugin and works fine.</p>

<p>I just need the images to display on my deleteimages.php page and only images are shown not subfolders within the folder.</p>
