<?php
$path = "../assets/tattoos/";
$path2 = "../assets/tattoos-thumbs/";
if(isset($_POST['file']) && is_array($_POST['file']))
{
foreach($_POST['file'] as $file)
{
unlink($path. "/" . $file) or die("Failed to delete file");
unlink($path2. "/" . $file) or die("<meta http-equiv=\"refresh\" content=\"0; url=index.php\" />");
}
}
?>
<form name="form1" method="post">
<?php
$imageDir = "../assets/tattoos/";
$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 "<input type='CHECKBOX' name='file[]' value='$file'>";
echo "<img src='../assets/tattoos/$file' style='height:auto;width:8%;' alt='$file'>";
}
closedir($dir_handle);
?>
<input type="submit" name="Delete" value="Delete">
</form>
I have this code, which calls an image directory and adds a checkbox next to it, you check the boxes you wish, hit delete and the pictures are removed from the server. I need them to display in a grid view, like 4 columns by X amount of rows. Any help would be greatly appreciated.