protected function rm($args) { $result = parent::rm($args); foreach ($args['targets'] as $target) { // If the image has a corresponding Visual, remove it $path = $this->getPath($target); $v = Visual::get_by_path($path); if ($v) { $v->delete(); } } return $result; }