Hello,
What I am trying to achieve is when an image name is selected from the dropdown menu in my site and delete is pushed instead of deleting just the row I would like it to unlink the image aswell:
I have the following code:
public function removeImage($image_id = NULL){
$sLocation =$_SERVER['DOCUMENT_ROOT']."/dir/includes/images/Gallery/";
// if there is no ID Exit
if(!$image_id) return;
global $database;
$image_id = $database->escape_value($image_id);
$this->loadImage($image_id);
$database->query("DELETE FROM Gallery WHERE id = $image_id");
if(is_file($this->sLocation . $this->setImagePath)) unlink($this->sLocation . $this->setImagePath);