/** * Delete the image on disk * * @param string $file_path the image file path * @param array $image_types The different sizes * @param string $parent_path The parent path * @return bool */ protected function deleteImageOnDisk($file_path, $image_types = null, $parent_path = null) { $this->wsObject->setOutputEnabled(false); if (file_exists($file_path)) { // delete image on disk @unlink($file_path); // Delete declinated image if needed if ($image_types) { foreach ($image_types as $image_type) { if ($this->defaultImage) { // @todo products images too !! $declination_path = $parent_path . $this->wsObject->urlSegment[3] . '-default-' . $image_type['name'] . '.jpg'; } else { $declination_path = $parent_path . $this->wsObject->urlSegment[2] . '-' . $image_type['name'] . '.jpg'; } if (!@unlink($declination_path)) { $this->objOutput->setStatus(204); return false; } } } return true; } else { $this->objOutput->setStatus(204); return false; } }