Topic: Show images to maintain
this little script
<?php
$path = "./";
$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 "<img src='$file' alt='$file'><br />";
}
closedir($dir_handle);?>
shows the images in a directory. Might be of some use to maintain your images.
Maybe if someone can add checkboxes so you can delete them..
this adds a checkbox
<?php
$path = "./";
$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>";
echo "<img src='$file' alt='$file'><br />";}
closedir($dir_handle);?>
and this i can't get to work :-)
<?php
$path = "./";
$dir_handle = @opendir($path) or die("Unable to open folder");//We list the name of the files again, since the name of the checkbox is the same with the name of the file
while (false !== ($file = readdir($dir_handle))) {if($file == "index.php")
continue;
if($file == ".")
continue;
if($file == "..")
continue;if(isset($_POST[$file])){
$checkbox = $_POST[$file];
if($checkbox == on) { //checkbox is selected
//Delete the file
if(!unlink($file)) die("Failed to delete file");
}
}
?>
I suggest you put this script in your THUMBS folder otherwise if you have lots of images it will load all day :-)
also edited your htaccess file to allow PHP files in the folder.
