code: public function purgeImageCache()
  	{
  		$container = System::getContainer();
  		$strTargetPath = StringUtil::stripRootDir($container->getParameter('contao.image.target_dir'));
  		$strRootDir = $container->getParameter('kernel.project_dir');
  
  		// Walk through the subfolders
  		foreach (scan($strRootDir . '/' . $strTargetPath) as $dir)
  		{
  			if (strncmp($dir, '.', 1) !== 0)
  			{
  				$objFolder = new Folder($strTargetPath . '/' . $dir);
  				$objFolder->purge();
  			}
  		}
  
  		// Also empty the page cache so there are no links to deleted images
  		$this->purgePageCache();
  
  		// Add a log entry
  		$this->log('Purged the image cache', __METHOD__, TL_CRON);
  	}
docs: Purge the image cache