isImage()) { throw new ExceptionBadArgument("The file ($path) has not been detected as being an image, media returned", FetcherImage::CANONICAL); } if ($mime->toString() === Mime::SVG) { $image = FetcherSvg::createSvgFromPath($path); } else { $image = FetcherRaster::createImageRasterFetchFromPath($path); } return $image; } /** * @param string $imageId * @param string|null $rev * @return IFetcherLocalImage * @throws ExceptionBadArgument - if the path is not an image */ public static function createImageFetchFromId(string $imageId, string $rev = null): IFetcherLocalImage { $dokuPath = WikiPath::createMediaPathFromId($imageId, $rev); return IFetcherLocalImage::createImageFetchFromPath($dokuPath); } function getBuster(): string { try { return FileSystems::getCacheBuster($this->getSourcePath()); } catch (ExceptionNotFound $e) { // file does not exists return strval((new \DateTime())->getTimestamp()); } } public function getLabel(): string { $sourcePath = $this->getSourcePath(); return ResourceName::getFromPath($sourcePath); } }