* Resolve a selected panorama picture to its file id. * * @param string $path * @return int * @throws \OCP\Files\NotFoundException * @throws \OCP\Files\NotPermittedException */
(string $path)
| 134 | * @throws \OCP\Files\NotPermittedException |
| 135 | */ |
| 136 | public function resolvePictureFile(string $path): int { |
| 137 | $path = ltrim($path, '/'); |
| 138 | if ($path === '') { |
| 139 | throw new \InvalidArgumentException('Picture path must not be empty'); |
| 140 | } |
| 141 | |
| 142 | $file = $this->rootFolder->getUserFolder($this->userId)->get($path); |
| 143 | if (!in_array($file->getMimeType(), self::PICTURE_MIME_TYPES, true)) { |
| 144 | throw new \InvalidArgumentException('Selected node is not a supported picture'); |
| 145 | } |
| 146 | |
| 147 | return (int)$file->getId(); |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * check if own report |