diff --git a/modules/system/models/File.php b/modules/system/models/File.php index 012342617..a4b72027c 100644 --- a/modules/system/models/File.php +++ b/modules/system/models/File.php @@ -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. */