protected function paste($args) { $result = parent::paste($args); $dest = $this->getPath($args['dst']); $cut = !empty($args['cut']); if ($cut) { foreach ($args['targets'] as $target) { // If the image has a corresponding Visual, update its .path field and move its thumbnail. $path = $this->getPath($target); $v = Visual::get_by_path($path); if ($v) { $base = basename($path); $v->path = $dest ? "{$dest}/{$base}" : $base; $v->save(); } } } return $result; }