Exemple #1
0
 /**
  * Adds the bespoke thumb and path property used by this widget.
  * @return System\Models\File
  */
 protected function decorateFileAttributes($file)
 {
     $file->thumb = $file->getThumb($this->imageWidth, $this->imageHeight, $this->thumbOptions);
     // Internal download link
     if (!$file->isImage() || !$file->isPublic()) {
         $file->pathOverride = \Backend\Controllers\Files::getDownloadUrl($file);
     }
     return $file;
 }
Exemple #2
0
 /**
  * Adds the bespoke attributes used internally by this widget.
  * - thumbUrl
  * - pathUrl
  * @return System\Models\File
  */
 protected function decorateFileAttributes($file)
 {
     /*
      * File is protected, create a secure public path
      */
     if (!$file->isPublic()) {
         $path = $thumb = FilesController::getDownloadUrl($file);
         if ($this->imageWidth || $this->imageHeight) {
             $thumb = FilesController::getThumbUrl($file, $this->imageWidth, $this->imageHeight, $this->thumbOptions);
         }
     } else {
         $path = $thumb = $file->getPath();
         if ($this->imageWidth || $this->imageHeight) {
             $thumb = $file->getThumb($this->imageWidth, $this->imageHeight, $this->thumbOptions);
         }
     }
     $file->pathUrl = $path;
     $file->thumbUrl = $thumb;
     return $file;
 }