mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 11:48:49 +02:00
Show a preview image in builtin attachment select autocomplete.
This commit is contained in:
parent
aa95f130db
commit
f0d0a78f65
6 changed files with 65 additions and 6 deletions
|
@ -91,6 +91,8 @@ class AttachmentURLGenerator
|
|||
$public_path = $this->public_path;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Our absolute path must begin with public path or we can not use it for asset pathes.
|
||||
if (0 !== strpos($absolute_path, $public_path)) {
|
||||
return null;
|
||||
|
@ -100,6 +102,19 @@ class AttachmentURLGenerator
|
|||
return substr($absolute_path, strlen($public_path) + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a placeholder path to a path to a image path.
|
||||
*
|
||||
* @param string $placeholder_path the placeholder path that should be converted
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function placeholderPathToAssetPath(string $placeholder_path): ?string
|
||||
{
|
||||
$absolute_path = $this->pathResolver->placeholderToRealPath($placeholder_path);
|
||||
return $this->absolutePathToAssetPath($absolute_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a URL under which the attachment file can be viewed.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue