Esempio n. 1
0
 /**
  * Get the path for a file version
  *
  * @param Version $file_version
  * @param ThumbnailVersion $thumbnail
  * @return null|string
  */
 public function getPath(Version $file_version, ThumbnailVersion $thumbnail)
 {
     /** @var File $file */
     $file = $file_version->getFile();
     $file_id = $file->getFileID();
     $storage_location = $file->getFileStorageLocationObject();
     $configuration = $storage_location->getConfigurationObject();
     $version_id = $file_version->getFileVersionID();
     $storage_location_id = $storage_location->getID();
     $thumbnail_handle = $thumbnail->getHandle();
     $path = $this->getStoredPath($file_id, $version_id, $storage_location_id, $thumbnail_handle);
     if ($path) {
         if ($configuration instanceof DeferredConfigurationInterface) {
             return $configuration->getPublicURLToFile($path);
         }
         return $path;
     } elseif ($path = $this->determinePath($file_version, $thumbnail, $storage_location, $configuration)) {
         $this->storePath($path, $file_id, $version_id, $storage_location_id, $thumbnail_handle);
         if ($configuration instanceof DeferredConfigurationInterface) {
             return $configuration->getPublicURLToFile($path);
         }
         return $path;
     }
 }
Esempio n. 2
0
 /**
  * @param mixed $version
  */
 public function setVersion(Version $version)
 {
     $this->fID = $version->getFileID();
     $this->fvID = $version->getFileVersionID();
 }