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


PHP LocalRepo::getLocalReference方法代码示例

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


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

示例1: getLocalRefPath

 /**
  * Get an FS copy or original of this file and return the path.
  * Returns false on failure. Callers must not alter the file.
  * Temporary files are cleared automatically.
  *
  * @return string|bool False on failure
  */
 public function getLocalRefPath()
 {
     $this->assertRepoDefined();
     if (!isset($this->fsFile)) {
         $this->fsFile = $this->repo->getLocalReference($this->getPath());
         if (!$this->fsFile) {
             $this->fsFile = false;
             // null => false; cache negative hits
         }
     }
     return $this->fsFile ? $this->fsFile->getPath() : false;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:19,代码来源:File.php

示例2: getThumbnailSource

 /**
  * Returns the most appropriate source image for the thumbnail, given a target thumbnail size
  * @param array $params
  * @return array Source path and width/height of the source
  */
 public function getThumbnailSource($params)
 {
     if ($this->repo && $this->getHandler()->supportsBucketing() && isset($params['physicalWidth']) && ($bucket = $this->getThumbnailBucket($params['physicalWidth']))) {
         if ($this->getWidth() != 0) {
             $bucketHeight = round($this->getHeight() * ($bucket / $this->getWidth()));
         } else {
             $bucketHeight = 0;
         }
         // Try to avoid reading from storage if the file was generated by this script
         if (isset($this->tmpBucketedThumbCache[$bucket])) {
             $tmpPath = $this->tmpBucketedThumbCache[$bucket];
             if (file_exists($tmpPath)) {
                 return array('path' => $tmpPath, 'width' => $bucket, 'height' => $bucketHeight);
             }
         }
         $bucketPath = $this->getBucketThumbPath($bucket);
         if ($this->repo->fileExists($bucketPath)) {
             $fsFile = $this->repo->getLocalReference($bucketPath);
             if ($fsFile) {
                 return array('path' => $fsFile->getPath(), 'width' => $bucket, 'height' => $bucketHeight);
             }
         }
     }
     // Thumbnailing a very large file could result in network saturation if
     // everyone does it at once.
     if ($this->getSize() >= 10000000.0) {
         // 10MB
         $that = $this;
         $work = new PoolCounterWorkViaCallback('GetLocalFileCopy', sha1($this->getName()), array('doWork' => function () use($that) {
             return $that->getLocalRefPath();
         }));
         $srcPath = $work->execute();
     } else {
         $srcPath = $this->getLocalRefPath();
     }
     // Original file
     return array('path' => $srcPath, 'width' => $this->getWidth(), 'height' => $this->getHeight());
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:43,代码来源:File.php

示例3: getThumbnailSource

 /**
  * Returns the most appropriate source image for the thumbnail, given a target thumbnail size
  * @param array $params
  * @return array Source path and width/height of the source
  */
 public function getThumbnailSource($params)
 {
     if ($this->repo && $this->getHandler()->supportsBucketing() && isset($params['physicalWidth']) && ($bucket = $this->getThumbnailBucket($params['physicalWidth']))) {
         if ($this->getWidth() != 0) {
             $bucketHeight = round($this->getHeight() * ($bucket / $this->getWidth()));
         } else {
             $bucketHeight = 0;
         }
         // Try to avoid reading from storage if the file was generated by this script
         if (isset($this->tmpBucketedThumbCache[$bucket])) {
             $tmpPath = $this->tmpBucketedThumbCache[$bucket];
             if (file_exists($tmpPath)) {
                 return array('path' => $tmpPath, 'width' => $bucket, 'height' => $bucketHeight);
             }
         }
         $bucketPath = $this->getBucketThumbPath($bucket);
         if ($this->repo->fileExists($bucketPath)) {
             $fsFile = $this->repo->getLocalReference($bucketPath);
             if ($fsFile) {
                 return array('path' => $fsFile->getPath(), 'width' => $bucket, 'height' => $bucketHeight);
             }
         }
     }
     // Original file
     return array('path' => $this->getLocalRefPath(), 'width' => $this->getWidth(), 'height' => $this->getHeight());
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:31,代码来源:File.php


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