diff --git a/system/src/Grav/Common/Page/Medium/Medium.php b/system/src/Grav/Common/Page/Medium/Medium.php index d6f147510..fb57aed8c 100644 --- a/system/src/Grav/Common/Page/Medium/Medium.php +++ b/system/src/Grav/Common/Page/Medium/Medium.php @@ -146,6 +146,21 @@ class Medium extends Data implements RenderableInterface return $this->get('filepath'); } + /** + * Return the relative path to file + * + * @param bool $reset + * @return mixed + */ + public function relativePath($reset = true) + { + if ($reset) { + $this->reset(); + } + + return str_replace(GRAV_ROOT, '', $this->get('filepath')); + } + /** * Return URL to file. *