/** * Returns the path which goes from the file, up to the root folder of the Gallery: * current_folder/my_file * * That root folder changes when folders are shared publicly * * @param File|Folder $node * * @return string */ public function getPathFromVirtualRoot($node) { $path = $node->getPath(); $nodeType = $node->getType(); // Needed because fromRootToFolder always ends with a slash if ($nodeType === 'dir') { $path .= '/'; } $path = str_replace($this->fromRootToFolder, '', $path); $path = rtrim($path, '/'); return $path; }