当前位置: 首页>>代码示例>>PHP>>正文


PHP FilesystemInterface::get方法代码示例

本文整理汇总了PHP中League\Flysystem\FilesystemInterface::get方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesystemInterface::get方法的具体用法?PHP FilesystemInterface::get怎么用?PHP FilesystemInterface::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Flysystem\FilesystemInterface的用法示例。


在下文中一共展示了FilesystemInterface::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: serveFromSource

 /**
  * Process a source image and Generate a response object
  *
  * @param  String  $path Path to the source image
  * @return Boolean
  */
 private function serveFromSource($path)
 {
     //try and load the image from the source
     if ($this->source->has($path)) {
         $file = $this->source->get($path);
         // Get the template object
         $template = $this->templates[$this->template]();
         // Process the image
         $image = $this->processImage($file, $this->imageManager, $template);
         // Set the headers
         $this->response->headers->set('Content-Type', $image->mime);
         $this->response->headers->set('Content-Length', strlen($image->encoded));
         $lastModified = new \DateTime();
         // now
         $this->setHttpCacheHeaders($lastModified, md5($this->getCachePath() . $lastModified->getTimestamp()), $this->maxAge);
         // Send the processed image in the response
         $this->response->setContent($image->encoded);
         // Setup a callback to write the processed image to the cache
         // This will be called after the image has been sent to the browser
         $this->cacheWrite = function (FilesystemInterface $cache, $path) use($image) {
             // use put() to write or update
             $cache->put($path, $image->encoded);
         };
         return true;
     }
     return false;
 }
开发者ID:diarmuidie,项目名称:imagerack-kernel,代码行数:33,代码来源:Server.php

示例2: getFileInfoByIdentifier

 /**
  * Returns information about a file.
  *
  * @param string $fileIdentifier
  * @param array $propertiesToExtract Array of properties which are be extracted
  *                                   If empty all will be extracted
  * @return array
  * @throws FileDoesNotExistException
  */
 public function getFileInfoByIdentifier($fileIdentifier, array $propertiesToExtract = [])
 {
     $relativeDriverPath = ltrim($fileIdentifier, '/');
     if (!$this->filesystem->has($relativeDriverPath) || !$this->filesystem->get($relativeDriverPath)->isFile()) {
         throw new FileDoesNotExistException('File ' . $fileIdentifier . ' does not exist.', 1314516809);
     }
     $dirPath = PathUtility::dirname($fileIdentifier);
     $dirPath = $this->canonicalizeAndCheckFolderIdentifier($dirPath);
     return $this->extractFileInformation($relativeDriverPath, $dirPath, $propertiesToExtract);
 }
开发者ID:cedricziel,项目名称:fal-flysystem,代码行数:19,代码来源:FlysystemDriver.php

示例3: setFile

 /**
  * Sets the file to stream.
  *
  * @param \SplFileInfo|string $file               The file to stream
  * @param string              $contentDisposition
  * @param bool                $autoEtag
  *
  * @return BinaryFileResponse
  *
  * @throws FileException
  */
 public function setFile($file, $contentDisposition = null, $autoEtag = false)
 {
     if ($file instanceof File) {
         $file->setFilesystem($this->filesystem);
     } else {
         $file = $this->filesystem->get($file);
     }
     if (!$this->filesystem->has($file->getPath())) {
         throw new FileException('File must be readable.');
     }
     $this->file = $file;
     if ($autoEtag) {
         $this->setAutoEtag();
     }
     if ($contentDisposition) {
         $this->setContentDisposition($contentDisposition);
     }
     return $this;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:30,代码来源:FlysystemFileResponse.php

示例4: __construct

 /**
  * @param FilesystemInterface $filesystem
  * @param string              $fileName
  *
  * @throws StorageException
  */
 public function __construct(FilesystemInterface $filesystem, $fileName = self::DEFAULT_FILENAME)
 {
     if (!$filesystem->has($fileName)) {
         $filesystem->write($fileName, '');
     }
     $handler = $filesystem->get($fileName);
     if (!$handler->isFile()) {
         throw new StorageException(sprintf('Expected path "%s" to be a file but its a "%s".', $handler->getPath(), $handler->getType()));
     }
     $this->file = $handler;
 }
开发者ID:baleen,项目名称:storage-flysystem,代码行数:17,代码来源:FlyStorage.php

示例5: get

 /**
  * Get a file/directory handler.
  *
  * @param string  $path    The path to the file.
  * @param Handler $handler An optional existing handler to populate.
  *
  * @return Handler Either a file or directory handler.
  */
 public function get($path, Handler $handler = null)
 {
     return $this->fileSystem->get($path, $handler);
 }
开发者ID:graze,项目名称:data-file,代码行数:12,代码来源:FilesystemWrapper.php


注:本文中的League\Flysystem\FilesystemInterface::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。