• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Show images to maintain

Status
Not open for further replies.

wout000

Chevereto Member
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.
 
Status
Not open for further replies.
Back
Top