added a relativePath() method

This commit is contained in:
Andy Miller
2017-05-25 06:13:27 -06:00
parent 4107518a02
commit 0ca58122a9

View File

@@ -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.
*