public function clearImageCache($deleteOriginals = false) { if (!$this->getId()) { return; } $cached = glob(aMediaItemTable::getDirectory() . DIRECTORY_SEPARATOR . $this->getSlug() . ".*"); foreach ($cached as $file) { if (!$deleteOriginals) { if (strpos($file, ".original.") !== false) { continue; } } unlink($file); } }
protected function getDirectory() { return aMediaItemTable::getDirectory(); }