mirror of
https://github.com/YGGverse/gemini-php.git
synced 2026-04-01 01:15:28 +00:00
add getMediaPathByUri method
This commit is contained in:
parent
ba326b9b3c
commit
26d85269e8
2 changed files with 37 additions and 1 deletions
|
|
@ -163,7 +163,31 @@ class Filesystem
|
|||
return $path;
|
||||
}
|
||||
|
||||
public function getData(string $path): ?string
|
||||
public function getMediaPathByUri(string $uri): ?string
|
||||
{
|
||||
$path = sprintf(
|
||||
'%s/media/%s',
|
||||
$this->_path,
|
||||
str_replace(
|
||||
':',
|
||||
'/',
|
||||
mb_strtolower(
|
||||
urldecode(
|
||||
$uri
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (!in_array($path, $this->_list) || !is_file($path) || !is_readable($path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function getData(?string $path): ?string
|
||||
{
|
||||
if (in_array($path, $this->_list) && is_file($path) || is_readable($path))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue