Get the URL of protected assets through the Backend Files controller if available.
This commit is contained in:
parent
2758c6711b
commit
4f7c5cc1e7
|
|
@ -19,6 +19,36 @@ class File extends FileBase
|
|||
*/
|
||||
protected $table = 'system_files';
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getThumb($width, $height, $options = [])
|
||||
{
|
||||
$url = '';
|
||||
if (!$this->isPublic() && class_exists('\Backend\Controllers\Files')) {
|
||||
$url = \Backend\Controllers\Files::getThumbUrl($this, $width, $height, $options);
|
||||
} else {
|
||||
$url = parent::getThumb($width, $height, $options);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
$url = '';
|
||||
if (!$this->isPublic() && class_exists('\Backend\Controllers\Files')) {
|
||||
$url = \Backend\Controllers\Files::getDownloadUrl($this);
|
||||
} else {
|
||||
$url = parent::getPath();
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* If working with local storage, determine the absolute local path.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue