So basically I have a PHP script that takes all the images from the user's individual folder in the directory and displays them on his/her gallery page. Now I want to add a delete function but im lost as to how to do it. Any help would be great!
<?php
$userid = $_GET['UID'];
$img_path = "./$userid";
chdir($img_path);
$images = glob('*.{jpg, jpeg, png, gif}', GLOB_BRACE);
foreach ($images as $image){
if (file_exists("./thumbs/$img_path/{image}")){
echo "<a href='$img_path/{$image}' rel='lightbox'><img src='./thumbs/$img_path/{$image}' alt=\"{$image}\" /></a>";
} else {
echo "<a href='$img_path/{$image}' rel='lightbox'><img src='./$img_path/{$image}' width='200' height='150' alt=\"{$image}\" /></a>";
}
}
?>